Skip to content

foreksorg/pubsub-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foreks Logo

Foreks publisher subscriber connection class

Installation

$ npm i foreks-pubsub-connector -s
import PubsubConnector from "foreks-pubsub-connector";

const options = {
  username: "", // socket username
  password: "", // socket password
  resource: "", // socket resource
  url: "", // socket url
  company: "", // company name
  appName: "", // application name
  isReconnection: false, // is reconnection default is false
  autoReconnect: true, // auto reconnect on error or on close
  reConnectInterval: 5000, // auto reconnect interval
  reConnectInterval: 5000, // auto reconnect interval
  sendData: Function, // on message event
};

const connector = new PubsubConnector(options);
await connector.connect();
connector.subscribe(["o17"], ["l"]);

// or you can use

const connector = new PubsubConnector(options);
connector.connect(options).then(() => {
  connector.subscribe(["o17"], ["l"]);
});