๐Ÿ” nlon-socket

Classes

SocketPeer โ‡ nlon.Peer

A socket-specific extension of nlon.Peer

SocketServer โ‡ nlon.Server

A socket-specific extension of nlon.Server.

Functions

createSocketPeer (options) โ‡’ SocketPeer

Create nlon peer managing a socket.

createSocketServer (options) โ‡’ SocketServer

Create an nlon server listening on socket.

wrapSocketPeer (socket, [options]) โ‡’ SocketPeer
wrapSocketServer (server, [options]) โ‡’ SocketServer

Wrap an existing net.Server instance with an nlon Server.

External

net.Server
net.Socket
nlon.Peer
nlon.PeerOptions
nlon.Server
nlon.ServerOptions

SocketPeer โ‡ nlon.Peer

A socket-specific extension of nlon.Peer

This class is an nlon Peer that wraps and manages a net.Socket instance. All messages arriving on the socket will be processed and all outbound traffic will be sent on the socket.

The underlying socket can also be accessed using .stream.

This class shouldn't be instantiated directly, instead use the factory methods.

Kind: global class

Extends: nlon.Peer

See:

SocketPeer#stream : net.Socket

Get the underlying Socket.

Kind: instance member


SocketServer โ‡ nlon.Server

A socket-specific extension of nlon.Server.

This class functions exactly the same as nlon.Server, with the addition that it keeps a reference to a net.Server which can be accessed through the .stream field.

Any incoming connection over this server will be automatically connected to and managed by the nlon server.

This class shouldn't be instantiated directly, instead use the factory methods.

Kind: global class

Extends: nlon.Server

See:

SocketServer#stream : net.Server

The underlying Server instance.

Kind: instance member

createSocketPeer (options) โ‡’ SocketPeer

Create nlon peer managing a socket.

This method will automatically create a socket based on the input options using net.createConnection.

The options parameter will be passed to both net.createConnection ( and by extension to net.Socket constructor and its .connect()) and to SocketPeer's constructor.

Kind: global function

ParamTypeDescription
optionsnet.SocketConstructorOpts, net.SocketConnectOpts, net.ConnectOpts, nlon.PeerOptions

Options


createSocketServer (options) โ‡’ SocketServer

Create an nlon server listening on socket.

A net.Server instance will be created based on the incoming options. This will also automatically call .listen() on the socket server before wrapping it in an nlon server.

The same options object will be passed to net.createServer, .listen() and the new nlon Server instance.

Kind: global function

ParamTypeDescription
optionsnet.ServerOpts, net.ListenOptions, nlon.ServerOptions

Options

See: wrapSocketServer


wrapSocketPeer (socket, [options]) โ‡’ SocketPeer

Wrap an existing net.Socket with an nlon Peer.

Kind: global function

ParamTypeDescription
socketnet.Socket

Socket

[options]nlon.PeerOptions

nlon peer options


wrapSocketServer (server, [options]) โ‡’ SocketServer

Wrap an existing net.Server instance with an nlon Server.

You will have to manually call .listen()!

Kind: global function

ParamTypeDescription
servernet.Server

Existing server

[options]nlon.ServerOptions

nlon Server options

net.Server

Node's TCP Server implementation.

Kind: global external

See: https://nodejs.org/api/net.html#class-netserver


net.Socket

Node's TCP Socket implementation.

Kind: global external

See: https://nodejs.org/api/net.html#class-netsocket


nlon.Peer

An nlon Peer.

Kind: global external

See: http://elementbound.github.io/nlon/reference/nlon/#class-Peer


nlon.PeerOptions

Options for an nlon Peer.

Kind: global external

See: http://elementbound.github.io/nlon/reference/nlon/#typedef-PeerOptions


nlon.Server

An nlon Server.

Kind: global external

See: http://elementbound.github.io/nlon/reference/nlon/#class-Server


nlon.ServerOptions

Options for an nlon Server.

Kind: global external

See: http://elementbound.github.io/nlon/reference/nlon/#typedef-ServerOptions

results matching ""

    No results matching ""