Added example of Using Observable

master
Naman Gupta 8 years ago committed by GitHub
parent 3f2691495f
commit 75b3f44603

@ -18,6 +18,15 @@ const realTimeAPI = new RealTimeAPI("wss://demo.rocket.chat/websocket");
realTimeAPI.keepAlive(); realTimeAPI.keepAlive();
// Responds "pong" to the "ping" message sent by the Realtime API. To keep the connection alive. // Responds "pong" to the "ping" message sent by the Realtime API. To keep the connection alive.
const auth = realTimeApi.login(USERNAME, PASSWORD);
// Creating Observable
//Now subscribing the observable
auth.subscribe(
(data) => console.log(data),
(err) => console.log(err),
() => console.log('completed'));
... ...
... ...

Loading…
Cancel
Save