@atlassian/pubsub
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.10 • Public • Published

    Atlassian PubSub

    Atlassian PubSub is the javascript client for Atlassian Frontend PubSub service.

    Installation

    $ yarn add @atlassian/pubsub
    $ npm install @atlassian/pubsub --save

    Usage

    As a component developer

    As a component developer, you should not instantiate a PubSubClient, instead you should let the product inject an instance in your component.

    import { PubSubClient } from '@atlassian/pubsub';
     
    class Component {
      private pubSubClient: PubSubClient;
      
      constructor(pubSubClient: PubSubClient) {
        this.pubSubClient = pubSubClient;
        this.subscribeToPubSubEvents();
      }
      
      private subscribeToPubSubEvents() {
        this.pubSubClient.on('avi:jira:updated:issue', this.onIssueUpdate);
      }
      
      onIssueUpdate = (event: string, payload) => {
        
      };
    }
     

    As a product developer

    import { default as Client } from '@atlassian/pubsub';
     
    const pubSubClient = new Client({
     product: 'STRIDE',
     url: 'https://api-private.atlassian.com/pubsub',
    });
     
    // Call join to join channels for the given context, for example for current conversations in Stride
    pubSubClient.join(['ari:cloud:banana:f7ebe2c0-0309-4687-b913-41d422f2110b:conversation/b17d8707-db6e-436e-95b9-102dd1986293']);
     
    // Call leave to leave channels (when closing a conversation for example)
    pubSubClient.leave(['ari:cloud:banana:f7ebe2c0-0309-4687-b913-41d422f2110b:conversation/b17d8707-db6e-436e-95b9-102dd1986293']);

    You should then make the pubSubClient available to components.

    Keywords

    none

    Install

    npm i @atlassian/pubsub

    DownloadsWeekly Downloads

    1

    Version

    1.1.10

    License

    Apache-2.0

    Unpacked Size

    35 kB

    Total Files

    30

    Last publish

    Collaborators

    • kbielaski
    • dwalker
    • atlassian-aui
    • jvdl
    • mdejongh
    • mszczepanski
    • cdarroch
    • macku
    • dboyd
    • dmorrow
    • mstaas
    • cwhittington
    • doklovic
    • 1999-atlassian
    • amcculloch
    • wyasvoin
    • jmoynihan
    • xqiu
    • gleal-atlassian
    • mszpyra
    • bcytrowski
    • plai1
    • sraj
    • tilwin_atlassian
    • mrzymski
    • media-build-bot
    • akishore
    • timse
    • mkem114
    • tsebastian
    • sfp-release-bot