Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
class ProtocolHandler
implements Dispatcher<ParserEvent>
import { ProtocolHandler } from "https://deno.land/x/natsws@v1.28.0/src/nats-base-client.ts";

Constructors

new
ProtocolHandler(options: ConnectionOptions, publisher: Publisher)

Properties

_closed: boolean
abortReconnect: boolean
closed: Deferred<Error | void>
connected: boolean
connectedOnce: boolean
optional
connectError: (err?: Error) => void
connectPromise: Promise<void> | null
features: Features
heartbeats: Heartbeat
inBytes: number
optional
info: ServerInfo
infoReceived: boolean
inMsgs: number
optional
lastError: NatsError
listeners: QueuedIterator<Status>[]
muxSubscriptions: MuxSubscription
noMorePublishing: boolean
outbound: DataBuffer
outBytes: number
outMsgs: number
parser: Parser
pendingLimit: number
pongs: Array<Deferred<void>>
publisher: Publisher
server: ServerImpl
servers: Servers
subscriptions: Subscriptions
transport: Transport
whyClosed: string

Methods

private
_close(err?: Error): Promise<void>
private
flushPending()
private
initMux(): void
private
prepare(): Deferred<void>
private
selectServer(): ServerImpl | undefined
_doDial(srv: Server): Promise<void>
close(): Promise<void>
dial(srv: Server): Promise<void>
dialLoop(): Promise<void>
disconnect(): void
disconnected(err?: Error): Promise<void>
dispatchStatus(status: Status): void
dodialLoop(): Promise<void>
drain(): Promise<void>
flush(p?: Deferred<void>): Promise<void>
getServer(): ServerImpl | undefined
isClosed(): boolean
processError(m: Uint8Array)
processInfo(m: Uint8Array)
processMsg(msg: MsgArg, data: Uint8Array)
publish(
subject: string,
payload?: Payload,
options?: PublishOptions,
)
push(e: ParserEvent): void
reconnect(): Promise<void>
resub(s: SubscriptionImpl, subject: string)
sendCommand(cmd: string | Uint8Array, ...payloads: Uint8Array[])
status(): AsyncIterable<Status>
unsub(s: SubscriptionImpl, max?: number)
unsubscribe(s: SubscriptionImpl, max?: number)

Static Methods

connect(options: ConnectionOptions, publisher: Publisher): Promise<ProtocolHandler>
toError(s: string)