Listen for all message events from the WebSocket client.
import { messages, ws } from '@buccaneer/rxws';
const ws$ = ws({url: 'wss://mysite.com'});
const messages$ = ws$.pipe(
messages()
);
messages$.subscribe(console.log);
// Output
// {topic: 'message', message: 'first message'}
// {topic: 'message', message: 'second message'}
import { messages, ws } from '@buccaneer/rxws';
const ws$ = ws({url: 'wss://mysite.com', topics: ['news']});
const messages$ = ws$.pipe(
messages('news')
);
messages$.subscribe(console.log);
// Output
// {topic: 'news', message: 'first message'}
// {topic: 'news', message: 'second message'}
messages(topic = 'message')