1.1.0 • Published 7 years ago

@socialgist/stream-client v1.1.0

Weekly downloads
1
License
-
Repository
github
Last release
7 years ago

Stream client library for NodeJS.

How to use

npm install --save @socialgist/stream-client

You need to create new instance of Client which you can configure by passing connection object to its constructor.

Client implements readable stream, so it can be piped or it can be consumed by listening to data events.

Client will automatically reconnect if connection is lost. If there is an error during connection to streaming API endpoint or connection gets closed, Client will emit error event. You must listen to these events but you don't have to act on them.

Example

const streaming = require('@socialgist/stream-client')

const client = new streaming.Client({
    username: "test",
    password: "123",
    customerName: "source1",
    dataSource: "stream1",
    streamName: "myname",
    subscriptionName: "sub1",
});
client.start();
client.pipe(process.stdout);
client.on('error', (e) => console.error(e));