How to use the socketcluster-client.SCClientSocket function in socketcluster-client

To help you get started, we’ve selected a few socketcluster-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-sdk / elements / lisk-p2p / src / peer / base.ts View on Github external
P2PPeerInfo,
	P2PRequestPacket,
	P2PResponsePacket,
	ProtocolMessagePacket,
} from '../p2p_types';
import {
	getNetgroup,
	sanitizeNodeInfoToLegacyFormat,
	validatePeerInfo,
	validatePeersInfoList,
	validateProtocolMessage,
	validateRPCRequest,
} from '../utils';

export const socketErrorStatusCodes = {
	...(socketClusterClient.SCClientSocket as any).errorStatuses,
	1000: 'Intentionally disconnected',
};

// Can be used to convert a rate which is based on the rateCalculationInterval into a per-second rate.
const RATE_NORMALIZATION_FACTOR = 1000;

interface Productivity {
	readonly requestCounter: number;
	readonly responseCounter: number;
	readonly responseRate: number;
	readonly lastResponded: number;
}

export type SCClientSocket = socketClusterClient.SCClientSocket;

export type SCServerSocketUpdated = {