1.0.1 • Published 6 years ago

callbag-websocket v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

callbag-websocket

Callbag sink and listenable source that connects using WebSocket interface.

Example

import websocket from 'callbag-websocket';
import observe from 'callbag-observe';

let ws = websocket('ws://demos.kaazing.com/echo');
let i = 0;
setInterval(() => {
  ws(1, 'msg' + i++);
}, 1000);

observe(msg => console.log('obs1', msg.data))(ws);

setTimeout(() => {
  observe(msg => console.log('obs2', msg.data))(ws);
}, 2500);

// OUTPUT:
// obs1 msg0
// obs1 msg1
// obs1 msg2
// obs2 msg2
// obs1 msg3
// obs2 msg3
// ...
1.0.1

6 years ago

1.0.0

6 years ago