Gracefully closes this WebSocket. Immediately calls the close handler. A WebSocket close message is sent with code and shortMessage.
Optional
code: numberOptional
shortMessage: RecognizedStringReturns the remote IP address. Note that the returned IP is binary, not text.
IPv4 is 4 byte long and can be converted to text by printing every byte as a digit between 0 and 255. IPv6 is 16 byte long and can be converted to text in similar ways, but you typically print digits in HEX.
See getRemoteAddressAsText() for a text version.
Returns whether this websocket is subscribed to topic.
Sends a ping control message. Returns sendStatus similar to WebSocket.send (regarding backpressure). This helper function correlates to WebSocket::send(message, uWS::OpCode::PING, ...) in C++.
Optional
message: RecognizedStringPublish a message under topic. Backpressure is managed according to maxBackpressure, closeOnBackpressureLimit settings. Order is guaranteed since v20.
Optional
isBinary: booleanOptional
compress: booleanSends a message. Returns 1 for success, 2 for dropped due to backpressure limit, and 0 for built up backpressure that will drain over time. You can check backpressure before or after sending by calling getBufferedAmount().
Make sure you properly understand the concept of backpressure. Check the backpressure example file.
Optional
isBinary: booleanOptional
compress: booleanSubscribe to a topic.
Unsubscribe from a topic. Returns true on success, if the WebSocket was subscribed.
Generated using TypeDoc
A WebSocket connection that is valid from open to close event. Read more about this in the user manual.