Getting Started
Installation
npm
npm i @bottlenose/rxsocketio --saveyarn
yarn add @bottlenose/rxsocketioOpen a two-way data stream using Socket.io
import { from } from 'rxjs';
import { conduit } from '@bottlenose/rxsocketio';
const messagesToSend$ = from([
{body: 'data'},
{body: 'more data'},
]);
// send messages over the WebSocket and receive messages back from it...
const socketResponse$ = messageToSend$.pipe(
conduit({url: 'http://mysite.com'})
);
socketResponse$.subscribe(
console.log, // log all messages received from the server
console.error,
() => console.log('Socket Closed!')
);Sending messages with a topic
Advanced options
Last updated