Construct a new connection - at the moment based on WebSockets
Readonly
idEvent is emitted when a new message is received.
Chum streams use the websocket bufferedAmount number to control how fast the streams provide data to the websocket stream.
Retrieve statistics.
The StatisticsPlugin has to be registered in order for this to work.
Add a plugin to the connection.
Optional
options: { after?: string; before?: string }Closes the connection.
This function waits for the other side to acknowledge.
Optional
reason: stringReason for timeout
Send data to the websocket.
Terminates the connection immediately without waiting for the other side.
Optional
reason: stringReason for timeout
Wait for the socket to be open.
Optional
timeout: number
This class is a wrapper for web sockets, that allows to receive messages with async / await instead of using callbacks (onmessage onopen ...)
It also has a on('message') event, because sometimes you just need it. When you solely use the event based interface, and don't use the waitForMessage functions, then you need to set disableWaitForMessage to true, because otherwise you will get an error that you didn't collect incoming messages with waitFor... functions.