Skip to content

A library used for publishing and subscribing for state change messages

Notifications You must be signed in to change notification settings

warp-contracts/warp-contracts-pubsub

Repository files navigation

Streamr

Configure client

Create client:

const client = new StreamrWsClient({
  direction: 'all'
});

Please see StreamrConnectionOptions for more configuration details.

Subscribe to a stream

const streamId = 'streamId';

const pubsub = await StreamrWsClient.create({
direction: 'sub',
streamId: streamId
});
pubsub.sub(
  (data) => console.log(data), 
  (err) => console.error('Failed to subscribe:', err)
);

Publish to a stream

const streamId = 'streamId';
const pubsub = StreamrWsClient.create({
  direction: 'sub',
  streamId: streamId
});
const data = { some: 'object' };
pubsub.pub(data, (err) => console.error('Failed to publish:', err));

About

A library used for publishing and subscribing for state change messages

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •