rx-socket

Rx Subject for Node sockets

Usage no npm install needed!

<script type="module">
  import rxSocket from 'https://cdn.skypack.dev/rx-socket';
</script>

README

rx-socket

RxJS Subject for Node Socket.

Installation

yarn add rx-socket

Usage

import { SocketSubject } from 'rx-socket'

const socket = new SocketSubject('/path/to/socket')

socket.subscribe(data => {
  // `data` will be an Object, expecting a JSON-encoded string to be provided
  console.log(data)
})

// `next()` will encode the provided value to JSON
socket.next({ hello: 'world' })

See the socket.connect() documentation for the supported SocketSubject constructor argument.

License

MIT.
See LICENSE file.