Untitled

mail@pastecode.io avatar
unknown
typescript
7 months ago
409 B
1
Indexable
Never
import { webSocket } from "rxjs/webSocket";
const subject = webSocket('wss://example.com');

subject.subscribe(
   msg => console.log('message received: ' + msg), // Called whenever there is a message from the server.
   err => console.log(err), // Called if at any point WebSocket API signals some kind of error.
   () => console.log('complete') // Called when connection is closed (for whatever reason).
 );
Leave a Comment