Creates a new stream.
when creating a stream with an ENS domain, the returned promise can take several minutes to settle
the stream id to be used for the new stream, and optionally, any associated metadata
Gets a stream, creating one if it does not exist.
when creating a stream with an ENS domain, the returned promise can take several minutes to settle
the stream id to get or create. Field partitions
is only used if creating the stream.
Optional
partitions?: numberReturns a list of subscriptions matching the given criteria.
Optional
streamDefinition: StreamDefinitionleave as undefined
to get all subscriptions
Publishes a message to a stream partition in the network.
the published message (note: the field content is encrypted if the stream is private)
the stream or stream partition to publish the message to
the content (the payload) of the message (must be JSON serializable)
Optional
metadata: PublishMetadataprovide additional metadata to be included in the message or to control the publishing process
Performs a resend of stored historical data.
a MessageStream that provides an alternative way of iterating messages. Rejects if the stream is not stored (i.e. is not assigned to a storage node).
the stream partition for which data should be resent
defines the kind of resend that should be performed
Optional
onMessage: MessageListenercallback will be invoked for each message retrieved
Subscribes to a stream partition in the network.
a Subscription that can be used to manage the subscription etc.
the stream or stream partition to subscribe to, additionally a resend can be performed by providing resend options
Optional
onMessage: MessageListenercallback will be invoked for each message received in subscription
Unsubscribes from streams or stream partitions in the network.
no-op if subscription does not exist
Optional
streamDefinitionOrSubscription: StreamDefinition | Subscriptionleave as undefined
to unsubscribe from all existing subscriptions.
Readonly
idStatic
Readonly
generateAdds an encryption key for a given publisher to the key store.
Keys will be added to the store automatically by the client as encountered. This method can be used to manually add some known keys into the store.
Destroys an instance of a StreamrClient by disconnecting from peers, clearing any pending tasks, and freeing up resources. This should be called once a user is done with the instance.
As the name implies, the client instance (or any streams or subscriptions returned by it) should not be used after calling this method.
Gets the Ethereum address of the wallet associated with the current StreamrClient instance.
This in an internal method
Returns the list of all permissions in effect for a given stream.
Gets the metadata of a storage node from the storage node registry.
rejects if the storage node is not found
Gets a list of storage nodes.
Optional
streamIdOrPath: stringif a stream is given, returns the list of storage nodes the stream has been assigned to;
leave as undefined
to return all storage nodes
Gets all streams assigned to a storage node.
a list of Stream as well as blockNumber
of result (i.e. blockchain state)
Gets all ethereum addresses that have PUBLISH permission to the stream.
Gets all ethereum addresses that have SUBSCRIBE permission to the stream.
Grants permissions on a given stream.
Rest
...assignments: PermissionAssignment[]Checks whether the given permission is in effect.
Checks whether a given ethereum address has PUBLISH permission to a stream.
Checks whether a given ethereum address has SUBSCRIBE permission to a stream.
Removes an event listener from the client.
event name, see StreamrClientEvents for options
the callback function to remove
Adds an event listener to the client.
event name, see StreamrClientEvents for options
the callback function
Adds an event listener to the client that is invoked only once.
event name, see StreamrClientEvents for options
the callback function
Revokes permissions on a given stream.
Rest
...assignments: PermissionAssignment[]Searches for streams based on given criteria.
a search term that should be part of the stream id of a result
permissions that should be in effect for a result
the default is ascending order by stream id field
Sets a list of permissions to be in effect.
Can be used to set the permissions of multiple streams in one transaction. Great for doing bulk operations and saving gas costs. Notice that the behaviour is overwriting, therefore any existing permissions not defined will be removed (per stream).
Rest
...items: { Optional
connectionCount: numberSets the metadata of a storage node in the storage node registry.
Acts on behalf of the wallet associated with the current StreamrClient instance.
if undefined
, removes the storage node from the registry
Manually updates the encryption key used when publishing messages to a given stream.
Updates the metadata of a stream.
the stream id and the metadata fields to be updated
Waits for a message to be stored by a storage node.
rejects if message was found in storage before timeout
the message to be awaited for
Optional
options: { additional options for controlling waiting and message matching
Optional
count?: numberControls size of internal resend used in polling.
Optional
interval?: numberDetermines how often should storage node be polled.
Optional
timeout?: numberTimeout after which to give up if message was not seen.
Generated using TypeDoc
The main API used to interact with Streamr.