Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@555platform/555-connection

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@555platform/555-connection

JavaScript SDK for 555 Connection

  • 1.0.0
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

555-connection

555 JavaScript SDK for connection

555-connection provides simple APIs to make connection with 555 Platform.

Getting started

npm i @555platform/555-connection

Usage - Examples

import SDK from '@555platform/555-connection';
  1. Make connection using 555token, ConnectOptions and MessageAdapter

    const sdk = SDK.Client.create(
    	    	userData.access_token,
    	    	{
    		  url: '',
    		  automaticReconnect: true
    	    	},
    	    	new SDK.QueuedMessageAdapter<SDK.MessagePayload>()
    	    );
    	
        
    sdk.connect();
    
  2. Callbacks

    sdk.onTokenAboutToExpire(() =>
     // renewToken is a function you need to implement to fetch new token
     // from application server
     renewToken(renewedToken => sdk.updateToken(renewedToken));
    );
    

APIs

Connect

Methods

<static> create(accessToken, ConnectOptions, messageAdapter)

Factory method to create and initialize Client

Parameters

NameTypeArgumentDescription
accessTokenstringrequired555 Platform access token
optionsConnectOptionsrequiredOptions to customize 555 Connection behavior
messageAdapterMessageAdapterrequiredMessage adapter class conforming to MessageAdapter interface

Returns

Type

Client|Error

updateToken(accessToken)

Updates current token. Used to update Client with refreshed token.

Parameters

NameTypeArgumentDescription
accessTokenstringrequired555 Platform access token

Returns

Type

void

connect()

Connect to platform.

Parameters

NameTypeArgumentDescription
optionsConnectOptionsoptionalConnection options

Returns

Type

Promise.<Client|void>

disconnect()

Manually disconnect the client.

Returns

Type

Promise.<void|Error>

AccessTokenAboutToExpire

Triggered 5 minutes before access token is to expire.

client.onTokenAboutToExpire(() =>
  // renewToken is a function you need to implement to fetch new token
  // from application server
  renewToken(renewedToken => sdk.updateToken(renewedToken));
);

Options

ConnectOptions

These options are parameters for connecting to platform.

Type

Object

Properties

NameTypeArgument
urlstringrequired
protocolstring[]optional
automaticReconnectbooleanoptional
reconnectionAttemptsnumberoptional
reconnectDelaynumberoptional
reconnectBackoffAlgorithmBackoffAlgorithmoptional
pollIntervalnumberoptional
requestTimeoutnumberoptional
requestRetriesnumberoptional
paginatorDefaultPageSizenumberoptional
nextPingDelaynumberoptional
pingWaitDelaynumberoptional

Keywords

FAQs

Package last updated on 25 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc