TransportPlugin

chat-service~ TransportPlugin

Transport plugin. Methods MUST return bluebird ^3.0.0 compatible promises (not just ES6 promises). Note: These methods MUST NOT be called directly. For public methods see chat-service.TransportInterface

Constructor

(protected) new TransportPlugin(server, options)

Implements:
Parameters:
Name Type Description
server chat-service.ChatService

Service instance.

options Object

Transport options.

Members

(protected, readonly) closed :boolean

Transport is closed and no any handlers invocations will be made.

Type:
  • boolean

(protected, readonly) clusterBus :EventEmitter

Cluster communication via an adapter. Emits messages to all services nodes, including the sender node.

Type:
  • EventEmitter

Methods

(protected) close() → {Promise.<undefined>}

Stops accepting clients' connections. Disconnects all currently connected clients.

Returns:

Promise that resolves without any data.

Type
Promise.<undefined>

(protected) disconnectSocket(id) → {Promise.<undefined>}

Disconnects a socket.

Parameters:
Name Type Description
id string

Socket id.

Returns:

Promise that resolves without any data.

Type
Promise.<undefined>

(protected) joinChannel(id, channel) → {Promise.<undefined>}

Adds a socket to a channel.

Parameters:
Name Type Description
id string

Socket id.

channel string

Transport channel.

Returns:

Promise that resolves without any data.

Type
Promise.<undefined>

(protected) leaveChannel(id, channel) → {Promise.<undefined>}

Removes a socket form a channel.

Parameters:
Name Type Description
id string

Socket id.

channel string

Transport channel.

Returns:

Promise that resolves without any data.

Type
Promise.<undefined>

(protected) setEvents() → {undefined}

Starts accepting clients' connections. On each new connection ChatService integration methods must be called. See src/SocketIOTransport.js for details about integration.

Returns:
Type
undefined