broadcast

Description

Broadcast (emit) messages to the server.

Usage

Basic Usage:

import { from } from 'rxjs';
import { broadcast, ws } from '@buccaneer/rxws';

const messagesToSend$ = from([
  {body: 'data'},
  {body: 'more data'},
]);
const ws$ = ws({url: 'wss://mysite.com'});
const messages$ = ws$.pipe(
  broadcast(messagesToSend$)
);

messages$.subscribe(); // this will attempt to send the messages to the server

API

broadcast(messagesToSend$<Observable>)

Since

1.0

Parameters

  • messagesToSend$: An Observable containing messages that will be sent to the server (whenever a message is emitted).

Options

None

Returns

{topic<String>,message<Any>}

Last updated