@blackglory/pubsub-js
v8.0.0
Published
```sh npm install --save @blackglory/pubsub-js # or yarn add @blackglory/pubsub-js ```
Downloads
20
Readme
pubsub-js
Install
npm install --save @blackglory/pubsub-js
# or
yarn add @blackglory/pubsub-js
API
PubSubClient
interface IPubSubClientOptions {
server: string
basicAuth?: {
username: string
password: string
}
keepalive?: boolean
heartbeat?: IHeartbeatOptions
timeout?: number
}
interface IPubSubClientRequestOptions {
signal?: AbortSignal
keepalive?: boolean
timeout?: number | false
}
interface IPubSubClientSubscribeOptions {
heartbeat?: IHeartbeatOptions
}
interface IHeartbeatOptions {
timeout: number
}
class PubSubClient {
constructor(options: IPubSubClientOptions)
publish(
namespace: string
, channel: string
, content: JSONValue
, options?: IPubSubClientRequestOptions
): Promise<void>
subscribe(
namespace: string
, channel: string
, options?: IPubSubClientSubscribeOptions
): AsyncIterableIterator<string>
}