Creates a Connection as a wrapper over a socket connection established to the akera.io application server.
The input stream.
The optional writable stream to pipe data to.
Sets the logger for this connection.
The logger instance that will be used by the connection.
Sets the 'default' logger for all new connections.
Returns the address of this connection
The address of the input open stream.
Closes the connection by closing the open socket stream, if already closed this is a no-op.
A promise that is resolved when connection is closed or rejected in case of error.
Enables the data handler on the open stream to start reading messages. If the connection is paused this just resumes reading.
Check whether the connection is allready closed or not.
Add a listener for the DATA event. The handler function need to receive one parameter of type Buffer.
Add a listener for the DONE event. Only fired when received a message of type DONE.
Add a listener for the ERROR event. The handler function needs to receive one parameter of type Error.
Add a listener for the MESSAGE event, fired when a complete message is received.
The handler function will receive the complete message as input.
Add a listener for the TIMEOUT event on open stream (only if {Socket}).
Pauses the reading on the open stream, that's it no messages will be processed until resumed.
Pipe all data read from input stream to the given pipe (passthrough).
The writable stream where data received on the open stream are to be pipe to.
Resumes reading on the open stream.
Sets a timeout on the open stream, the callback function will be called if the time elapse while no data is received through the open stream.
The time out period in milliseconds.
The callback function to be called when/if time elapse.
Stop sending data from the input stream to the previous 'pipe' stream if any.
Write a message through the open connection stream. Returns a promise that will be resolved when message is written in full or rejected in case of error.
The message to write to the open stream.
Establish a connection (socket) to an akera.io application server (host, port). Returns a promise that is either rejected in case of error or resolves with a AkeraConnection.
It can be either a string with the host name/address or a complete connect info.
The server port number, unless the first parameter is a ConnectInfo.
The SSL options, unless the first parameter is a ConnectInfo.
This is used to establish a connection to an akera.io application server in order to exchange messages using a specific exchange protocol.