From 75b3f44603a00c4243145ee04c070b1ffa78a893 Mon Sep 17 00:00:00 2001 From: Naman Gupta Date: Thu, 29 Jun 2017 02:49:00 +0530 Subject: [PATCH] Added example of Using Observable --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 513b361..c8e4d39 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,15 @@ const realTimeAPI = new RealTimeAPI("wss://demo.rocket.chat/websocket"); realTimeAPI.keepAlive(); // 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')); ... ...