new Connection(options)
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Required options to initialize the TCP connection Properties
|
- Source:
Throws:
-
If one of the parameters weren't provided
- Type
- Error
Members
-
closed :boolean
-
Whether the connection has been closed
Type:
- boolean
- Source:
-
socket :net.Socket
-
A reference to the socket.
Type:
- net.Socket
- Source:
-
timeout :number
-
Timeout for the socket in milliseconds. Defaults to 5 seconds
Type:
- number
- Source:
Methods
-
connect()
-
Attempts to connect to the TCP socket
- Source:
-
disconnect()
-
Disconnects from the TCP socket
- Source:
-
reconnect()
-
Reconnects to the socket (same as doing a disconnect and then a connect)
- Source:
-
write(data)
-
Attempts to send data through the socket
Parameters:
Name Type Description dataObject The data to send
- Source:
Fires:
- Connection:write