# @atlassian/pubsub

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

Latest version **1.1.10** (published 2018-03-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @atlassian/pubsub
pnpm add @atlassian/pubsub
yarn add @atlassian/pubsub
bun add @atlassian/pubsub
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.10 |
| Published | 2018-03-28 |
| First published | 2018-03-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 34.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | atlassian_fabric_elements, atlassian-aui, cdarroch, cwhittington, dboyd, dmorrow, dwalker, jhoarau, jvdl, macku, mdejongh, mstaas, mszczepanski, shnooshnoo |

## Links

- npm: https://www.npmjs.com/package/@atlassian/pubsub
- Repository: git@bitbucket.org:atlassian/pubsub-client
- npm.io page: https://npm.io/package/@atlassian/pubsub

## Dependencies (4)

- [pubnub](https://npm.io/package/pubnub.md) ^4.20.0
- [eventemitter2](https://npm.io/package/eventemitter2.md) ^5.0.1
- [url-search-params](https://npm.io/package/url-search-params.md) ^0.10.0
- [@atlaskit/util-service-support](https://npm.io/package/@atlaskit/util-service-support.md) ^2.0.4

## Recent versions

- 1.1.10 (latest) — 2018-03-28
- 1.1.9 — 2018-03-27

## README

# Atlassian PubSub

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

## Installation 

```shell
$ 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.

```typescript
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

```typescript
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.

---
_Source: https://npm.io/package/@atlassian/pubsub · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
