Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1004 Bytes

Readme.md

File metadata and controls

38 lines (30 loc) · 1004 Bytes

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"]);
});