Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
interface StoredMsg
import { type StoredMsg } from "https://deno.land/x/natsws@v1.28.0/src/mod.ts";

An interface representing a message that retrieved directly from JetStream.

Properties

subject: string

The subject the message was originally received on

seq: number

The sequence number of the message in the Stream

header: MsgHdrs

Headers for the message

data: Uint8Array

The payload of the message body

time: Date

The time the message was received

timestamp: string

The raw ISO formatted date returned by the server

Methods

json<T>(reviver?: ReviverFn): T

Convenience method to parse the message payload as JSON. This method will throw an exception if there's a parsing error;

string(): string

Convenience method to parse the message payload as string. This method may throw an exception if there's a conversion error