Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/natsws/src/mod.ts

WebSocket NATS
Go to Latest
import * as natsws from "https://deno.land/x/natsws@v1.28.0/src/mod.ts";

Enums

The different kinds of Advisories

These events represent informational notifications emitted by ConsumerMessages that can be safely ignored by clients.

ConsumerEvents are informational notifications emitted by ConsumerMessages that may be of interest to a client.

Other events that can be reported by the NatsConnection#status iterator. These can usually be safely ignored, as higher-order functionality of the client will handle them.

Events reported by the NatsConnection#status iterator.

Possible error codes on exceptions thrown by the library.

Functions

Returns a Backoff with the specified interval policy set.

Returns an Authenticator function that returns a JwtAuth. This is a convenience Authenticator that parses the specified creds and delegates to the jwtAuthenticator.

Returns a Promise that has a resolve/reject methods that can be used to resolve and defer the Deferred.

Returns true if the message is a flow control message

Returns true if the message is a heart beat message

Returns a Codec for encoding JavaScript object to JSON and serialize them to an Uint8Array, and conversely, from an Uint8Array to JSON to a JavaScript Object.

Returns an Authenticator function that returns a JwtAuth. If a seed is provided, the public key, and signature are calculated.

Convert the specified Nanos into millis

Converts the specified millis into Nanos

Returns an Authenticator that returns a NKeyAuth based that uses the specified seed or function returning a seed.

Creates a KeyPair with an account prefix

Creates a KeyPair with an operator prefix

Creates a KeyPair with an user prefix

Decode a base64 encoded string to a binary Uint8Array

Encode binary data to a base64 string

Creates a KeyPair from a specified public key

Creates a KeyPair from a specified seed.

Returns a Codec for encoding strings to a message payload and decoding message payloads into strings.

syncIterator is a utility function that allows an AsyncIterator to be triggered by calling next() - the utility will yield null if the underlying iterator is closed. Note it is possibly an error to call use this function on an AsyncIterable that has already been started (Symbol.asyncIterator() has been called) from a looping construct.

Returns a token authenticator for the specified token

Returns a user/pass authenticator for the specified user and optional password

Interfaces

An advisory is an interesting event in the JetStream server

Authenticator is an interface that returns credentials.

An interface that reports via a promise when an object such as a connection or subscription closes.

A JetStream interface that allows you to request the ConsumerInfo on the backing object.

A builder API that creates a ConsumerOpt

Interface for interacting with JetStream data

The API for interacting with JetStream resources

Options to a JetStream options applied to all JetStream or JetStreamManager requests.

Options for messages published to JetStream

Represents a message stored in JetStream

An interface for encoding and decoding values before they are stored or returned to the client.

An interface for listing. Returns a promise with typed list.

Records messages that were damaged and unrecoverable

Represents a message delivered by NATS. This interface is used by Subscribers.

The response returned by the JetStream server when a message is added to a stream.

Options for a JetStream pull subscription which define how long the pull request will remain open and limits the amount of data that the server could return.

ServerInfo represents information from the connected server

ServerChanged records servers in the cluster that were added or deleted.

An interface representing a message that retrieved directly from JetStream.

An alternate location to read mirrored data

Sets default consumer limits for inactive_threshold and max_ack_pending to consumers of this stream that don't specify specific values. This functionality requires a server 2.10.x or better.

Stream configuration info

Information about an upstream stream source in a mirror

Stream options that can be updated

Basic interface to a Subscription type

Subscription Options

TlsOptions that can be specified to a client. Note that the options are typically runtime specific, so some clients won't support them at all. In other cases they will match to the runtime's TLS options.

The interface for creating instances of different JetStream materialized views.

Type Aliases

DispatcherFn allows for values to be processed after being presented to the iterator. Note that if the ProtocolFilter rejected the value it will not be presented to the DispatchedFn. Any processing should instead have been handled by the ProtocolFilterFn.

A service Endpoint

Statistics for an endpoint

Options for fetching bytes

Options for fetching messages

IngestionFilterFn prevents a value from being ingested by the iterator. It is executed on push. If ingest is false the value shouldn't be pushed. If protcol is true, the value is a protcol value

The JetStream pull subscription object.

The JetStream Subscription object

The signature a message handler for a JetStream subscription.

Converts a NATS message into some other type. Implementers are expected to: return [err, null] if the message callback is invoked with an error. return [err, null] if converting the message yielded an error, note that iterators will stop on the error, but callbacks will be presented with the error. return [null, T] if the conversion worked correctly

Value expressed as Nanoseconds - use the nanos(millis) function to convert millis to nanoseconds. Note that in some environments this could overflow.

An object that allows reading the object stored under a specified name.

These options are a subset of ConsumerConfig and ConsumerUpdateConfig

ProtocolFilterFn allows filtering of values that shouldn't be presented to the iterator. ProtocolFilterFn is executed when a value is about to be presented

A reviver function

The stats of a service

Options for StreamAPI info requests

Type alias for NATS core subscriptions

Subscription Options

Callback presented to the user with the converted type