Class: StreamMessage<T>
Type parametersβ
Name | Type |
---|---|
T | unknown |
Constructorsβ
constructorβ
β’ new StreamMessage<T
>(Β«destructuredΒ»
)
Type parametersβ
Name | Type |
---|---|
T | unknown |
Parametersβ
Name | Type |
---|---|
Β«destructuredΒ» | StreamMessageOptions <T > |
Propertiesβ
contentTypeβ
β’ contentType: JSON
encryptionTypeβ
β’ encryptionType: EncryptionType
groupKeyIdβ
β’ groupKeyId: null
| string
messageIdβ
β’ messageId: MessageID
messageTypeβ
β’ messageType: StreamMessageType
newGroupKeyβ
β’ newGroupKey: null
| EncryptedGroupKey
parsedContentβ
β’ Optional
parsedContent: T
prevMsgRefβ
β’ prevMsgRef: null
| MessageRef
serializedContentβ
β’ serializedContent: string
signatureβ
β’ signature: string
LATEST_VERSIONβ
βͺ Static
LATEST_VERSION: number
Methodsβ
cloneβ
βΈ clone(): StreamMessage
<T
>
Create a new StreamMessage identical to the passed-in streamMessage.
Returnsβ
getContentβ
βΈ getContent(): string
Returnsβ
string
βΈ getContent(parsedContent
): string
Parametersβ
Name | Type |
---|---|
parsedContent | false |
Returnsβ
string
βΈ getContent(parsedContent
): T
Parametersβ
Name | Type |
---|---|
parsedContent | true |
Returnsβ
T
getMessageIDβ
βΈ getMessageID(): MessageID
Returnsβ
getMessageRefβ
βΈ getMessageRef(): MessageRef
Returnsβ
getMsgChainIdβ
βΈ getMsgChainId(): string
Returnsβ
string
getNewGroupKeyβ
βΈ getNewGroupKey(): null
| EncryptedGroupKey
Returnsβ
null
| EncryptedGroupKey
getParsedContentβ
βΈ getParsedContent(): T
Lazily parses the content to JSON
Returnsβ
T
getPreviousMessageRefβ
βΈ getPreviousMessageRef(): null
| MessageRef
Returnsβ
null
| MessageRef
getPublisherIdβ
βΈ getPublisherId(): [EthereumAddress
](../API Reference#ethereumaddress)
Returnsβ
[EthereumAddress
](../API Reference#ethereumaddress)
getSequenceNumberβ
βΈ getSequenceNumber(): number
Returnsβ
number
getSerializedContentβ
βΈ getSerializedContent(): string
Returnsβ
string
getStreamIdβ
βΈ getStreamId(): [StreamID
](../API Reference#streamid)
Returnsβ
[StreamID
](../API Reference#streamid)
getStreamPartIDβ
βΈ getStreamPartID(): [StreamPartID
](../API Reference#streampartid)
Returnsβ
[StreamPartID
](../API Reference#streampartid)
getStreamPartitionβ
βΈ getStreamPartition(): number
Returnsβ
number
getTimestampβ
βΈ getTimestamp(): number
Returnsβ
number
serializeβ
βΈ serialize(version?
): string
Parametersβ
Name | Type |
---|---|
version? | number |
Returnsβ
string
deserializeβ
βΈ Static
deserialize(msg
): StreamMessage
<unknown
>
Takes a serialized representation (array or string) of a message, and returns a StreamMessage instance.
Parametersβ
Name | Type |
---|---|
msg | string | any [] |
Returnsβ
StreamMessage
<unknown
>
getSupportedVersionsβ
βΈ Static
getSupportedVersions(): number
[]
Returnsβ
number
[]
isEncryptedβ
βΈ Static
isEncrypted<T
>(msg
): msg is StreamMessageEncrypted<T>
Type parametersβ
Name | Type |
---|---|
T | unknown |
Parametersβ
Name | Type |
---|---|
msg | StreamMessage <T > |
Returnsβ
msg is StreamMessageEncrypted<T>
isUnencryptedβ
βΈ Static
isUnencrypted<T
>(msg
): msg is StreamMessageUnencrypted<T>
Type parametersβ
Name | Type |
---|---|
T | unknown |
Parametersβ
Name | Type |
---|---|
msg | StreamMessage <T > |
Returnsβ
msg is StreamMessageUnencrypted<T>
validateContentTypeβ
βΈ Static
validateContentType(contentType
): void
Parametersβ
Name | Type |
---|---|
contentType | JSON |
Returnsβ
void
validateEncryptionTypeβ
βΈ Static
validateEncryptionType(encryptionType
): void
Parametersβ
Name | Type |
---|---|
encryptionType | EncryptionType |
Returnsβ
void
validateMessageTypeβ
βΈ Static
validateMessageType(messageType
): void
Parametersβ
Name | Type |
---|---|
messageType | StreamMessageType |
Returnsβ
void
validateSequenceβ
βΈ Static
validateSequence(Β«destructuredΒ»
): void
Parametersβ
Name | Type |
---|---|
Β«destructuredΒ» | Object |
βΊΒ messageId | MessageID |
βΊΒ prevMsgRef? | null | MessageRef |
Returnsβ
void
versionSupportsEncryptionβ
βΈ Static
versionSupportsEncryption(streamMessageVersion
): boolean
Parametersβ
Name | Type |
---|---|
streamMessageVersion | number |
Returnsβ
boolean