Module: models/Connection

Represents a TCP connection. This is used as a wrapper for the connection to the data relay

Author:
  • Serge Babayan
Source:
See:

Extends

  • EventEmitter

Requires

  • module:util/Logger
  • module:net
  • module:util
  • module:events
  • module:config/advanced-config

Classes

Connection

Methods


<inner> setTimeout(timeout)

Sets the timeout for the socket connection in milliseconds

Parameters:
Name Type Description
timeout int
Source:

Events


Connection:close

Emitted when the socket has been closed. Passes true if it closed due to an error

Type: bool
Source:

Connection:connect

Emitted when the socket has successfully connected

Type: null
Source:

Connection:data

Emitted when the socket has received a packet of data

Type: Buffer
Source:

Connection:socket_error

Emitted when an error has occurred on the socket. Does not throw an error if there are no listeners

Type: Object
Source:

Connection:timeout

Emitted when the socket has timed out (receiving no data but still connected)

Type: null
Source:

Connection:write

Emitted if data was successfully sent through the socket. Passes back the data sent

Type: Object
Source: