MsgpackSock
Msgpack wrap for net.Socket and tls.TLSSocket
Installation
npm install --save msgpack-sock
Using
const net = ;const MsgpackSock = ; //echo servernet; //clientconst socket = MsgpackSock;socket;socket;socket;socket;
Api
Static methods
- MsgpackSock.createConnectionHandler (callback: function(socket: MsgpackSock), codec: ?msgpackLite.Codec): function(socket: net.Socket | tls.TLSSocket)
- MsgpackSock.wrap (socket: net.Socket | tls.TLSSocket, codec: ?msgpackLite.Codec): MsgpackSock
- MsgpackSock.createCodec - see https://www.npmjs.com/package/msgpack-lite#custom-extension-types-codecs
- MsgpackSock.encode - see https://www.npmjs.com/package/msgpack-lite#encoding-and-decoding-messagepack
- MsgpackSock.decode - see https://www.npmjs.com/package/msgpack-lite#encoding-and-decoding-messagepack
Events
- message (msg: any) - New message received
- close () - Socket closed
- error (err: Error) - Received error
- connect - transfered from net.Socket
- drain - transfered from net.Socket
- lookup - transfered from net.Socket
- timeout - transfered from net.Socket
- OCSPResponse - transfered from tls.TLSSocket
- secureConnect - transfered from tls.TLSSocket
Methods
- send (msg: any) - Send message
- close () - Close connection
- address - from net.Socket
- setKeepAlive - from net.Socket
- setNoDelay - from net.Socket
- setTimeout - from net.Socket
- ref - from net.Socket
- unref - from net.Socket
- getCipher = from tls.TLSSocket
- getEphemeralKeyInfo = from tls.TLSSocket
- getPeerCertificate = from tls.TLSSocket
- getProtocol = from tls.TLSSocket
- getSession = from tls.TLSSocket
- getTLSTicket = from tls.TLSSocket
- renegotiate = from tls.TLSSocket
- setMaxSendFragment = from tls.TLSSocket