ws-json-client-stream

A wrapper around the ws npm module that adds JSON-parsing stream interface.

Usage no npm install needed!

<script type="module">
  import wsJsonClientStream from 'https://cdn.skypack.dev/ws-json-client-stream';
</script>

README

ws-json-client-stream

A wrapper around the ws npm module that adds JSON-parsing stream interface.

Example usage

Below is an example that subscribes to all the transactions happening on the Stellar network. Stellar API endpoint documentation

var _ = require( 'highland' ),
    socket = require( 'ws-json-client-stream' ),
    stellarSocket = socket( 'ws://live.stellar.org:9001' );

_(stellarSocket).each(console.log);

stellarSocket.write({
  "command" : "subscribe",
  "streams" :  [ "transactions" ]
});