Entry point for app JavaScript to send and broadcast websocket messages and query connected sockets, bound into the JS engine context as the global websocketWrapper variable. It delegates to the shared KademiWebsocketApplication, which tracks every live connection registered through WebsocketMappingBuilder, grouped by the app's channel type and an application defined item id.


Methods

broadcast(String type, Object itemId, String msg)

Returns: void

Broadcasts a message to every websocket connection registered for the given channel type and item id.

ParameterDescription
typethe channel type the target sockets were registered under
itemIdthe item id the target sockets were registered under
msgthe message text to send

send(RepoAppWebsocket ws, String msg)

Returns: void

Sends a message to a single websocket connection.

ParameterDescription
wsthe websocket wrapper identifying the connection to send to
msgthe message text to send

send(KademiWebsocket kws, String msg)

Returns: void

Sends a message to a single websocket connection, identified directly by its underlying connection object.

ParameterDescription
kwsthe underlying websocket connection to send to
msgthe message text to send

getWebsockets(String type)

Returns: List<RepoAppWebsocket>

Finds every currently connected websocket registered for the given channel type.

ParameterDescription
typethe channel type to look up connections for

getWebsockets(String type, Object itemId)

Returns: List<RepoAppWebsocket>

Finds every currently connected websocket registered for the given channel type and item id.

ParameterDescription
typethe channel type to look up connections for
itemIdthe item id to filter connections by

isUserConnected(ProfileBean pb, String type, Object itemId)

Returns: boolean

Checks whether the given user has a currently connected websocket for the given channel type and item id.

ParameterDescription
pbthe user to check
typethe channel type to check
itemIdthe item id to check

isUserConnected(UserResource user, String type, Object itemId)

Returns: boolean

Checks whether the given user has a currently connected websocket for the given channel type and item id.

ParameterDescription
userthe user to check
typethe channel type to check
itemIdthe item id to check

isUserConnected(Profile profile, String type, Object itemId)

Returns: boolean

Checks whether the given profile has a currently connected websocket for the given channel type and item id.

ParameterDescription
profilethe profile to check
typethe channel type to check
itemIdthe item id to check
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.