You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Viraj Trivedi 489d8e04ef Merge pull request #8 from inf3cti0n95/readme-update
Update README.md
8 years ago
lib Generic Method for Realtime API method calls 8 years ago
src Generic Method for Realtime API method calls 8 years ago
.gitignore Initial commit 8 years ago
.npmignore Rename .npmingnore to .npmignore 8 years ago
LICENSE Initial commit 8 years ago
README.md Update README.md 8 years ago
package-lock.json Implementation of Methods for Login 8 years ago
package.json Changed name of the Package and Link to the Repository Updated 8 years ago
tsconfig.json Initial Commit 8 years ago
yarn.lock Implementation of Methods for Login 8 years ago

README.md

Rocket.Chat.RealTime.API.Abstraction

Abstraction for Utilizing Rocket.Chat's Realtime API Methods with RxJS

Installation

npm install --save rocket.chat.realtime.api.rxjs 

Usage


import { RealTimeAPI } from "rocket.chat.realtime.api.rxjs";

const realTimeAPI =  new RealTimeAPI("wss://demo.rocket.chat/websocket");
// Provide, URL to the Rocket.Chat's Realtime API.


realTimeAPI.connectToServer(); 
// Connects to the RealTime API

realTimeAPI.keepAlive(); 
// Responds "pong" to the "ping" message sent by the Realtime API. To keep the connection alive.

...
...

// Use any of the methods implmented in the package.

Methods

Methods Functionality
connectToServer() Connects to the RealTime API.
keepAlive() Responds "pong" to the "ping" message sent by the Realtime API. To keep the connection alive.
login(username, password) Returns Observable to the Result/Response from the RealTime API.
loginWithAuthToken(authToken) Returns Observable to the Result/Response from the RealTime API.
loginWithOAuth(credToken, credSecret) Returns Observable to the Result/Response from the RealTime API.
callMethod(methodName, ...params) Returns Observable to the Result of Method Call from Rocket.Chat Realtime API
sendMessage(jsonObject) Sends the JSON Object to the API Server
onMessage( message => console.log(message) ) Subscribes to the Messages sent from the server
onError( error => console.error(error) ) Subscribes to the Errors.
onCompletion(() => console.info("Complete")) Subscribes to Completion on the Websocket Connection
subscribe(messageHandler, errorHandler, completionHandler) Subscribes to All three i.e - messages, errors and completion
getObservable() Returns observable of the WebSocket Connection to the RealTime API

Checkout the Rocket.Chat's RealTime API documentation for furter information on working of the RealTime API.