```sh npm install --save @blackglory/pubsub-js # or yarn add @blackglory/pubsub-js ```
npm install @blackglory/pubsub-jssh
npm install --save @blackglory/pubsub-js
or
yarn add @blackglory/pubsub-js
`API
$3
`ts
interface IPubSubClientOptions {
server: string
basicAuth?: {
username: string
password: string
}
keepalive?: boolean
heartbeat?: IHeartbeatOptions
timeout?: number
}interface IPubSubClientRequestOptions {
signal?: AbortSignal
keepalive?: boolean
timeout?: number | false
}
export interface IPubSubClientSubscribeOptions extends IPubSubClientRequestOptions {
heartbeat?: IHeartbeatOptions
}
interface IHeartbeatOptions {
timeout: number
}
class PubSubClient {
constructor(options: IPubSubClientOptions)
publish(
namespace: string
, channel: string
, content: JSONValue
, options?: IPubSubClientRequestOptions
): Promise
subscribe(
namespace: string
, channel: string
, options?: IPubSubClientSubscribeOptions
): AsyncIterableIterator
}
``