@unitybase/ub/web-sockets

High level WebSocket protocols implementation
Author:
  • pavel.mash

Classes

WebSocketTransport
JsonMessagesProtocol

Methods

registeredProtocols() → Array.<string> inner

Return array of currently registered WS protocol names

getWSNotifier()JsonMessagesProtocol inner

Return an instance of JsonMessagesProtocol named ubNotifier for Server<->Client communication using WebSocket

In case ubNotifier protocol is not registered during WebSocket thread initialization or not configured in config - will return null

Returned JsonMessagesProtocol instance methods is limited by WSProtocol#getUserSessions, WSProtocol#sendTo and WSProtocol#broadcast

See web_sockets.md for detailed descripiuon

Events

connect

Emited for JsonMessagesProtocol just after client is connected

disconnect

Emited for JsonMessagesProtocol just after client is disconnected