https://github.com/mainframeos/rx-socket
RxJS Subject for Node sockets
https://github.com/mainframeos/rx-socket
Last synced: 11 months ago
JSON representation
RxJS Subject for Node sockets
- Host: GitHub
- URL: https://github.com/mainframeos/rx-socket
- Owner: MainframeOS
- License: mit
- Created: 2017-11-16T17:35:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-13T14:07:49.000Z (over 7 years ago)
- Last Synced: 2025-07-26T09:13:42.024Z (11 months ago)
- Language: TypeScript
- Size: 285 KB
- Stars: 2
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# rx-socket
[RxJS Subject](https://rxjs.dev/guide/subject) for
[Node Socket](https://nodejs.org/api/net.html#net_class_net_socket).
## Installation
```sh
yarn add rx-socket
```
## Usage
```js
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](https://nodejs.org/api/net.html#net_socket_connect)
for the supported `SocketSubject` constructor argument.
## License
MIT.\
See [LICENSE](LICENSE) file.