Hullo JS
Search…
⌃K
Links

ofWebSocket

import { ofWebSocket } from '@hullo/browser'
Adapter for WebSocket class for Hullo.
import { ofWebSocket } from '@hullo/browser';
const ws = new WebSocket('ws://example.com');
const ws$ = ofWebSocket(ws);
ws$.subscribe({
next(data) {
if (typeof data === 'string') {
console.log('received', data);
}
}
});
// sending
ws$.next('hello 👋')
Last modified 3yr ago