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.
| Parameter | Description |
|---|---|
type | the channel type the target sockets were registered under |
itemId | the item id the target sockets were registered under |
msg | the message text to send |
send(RepoAppWebsocket ws, String msg)
Returns: void
Sends a message to a single websocket connection.
| Parameter | Description |
|---|---|
ws | the websocket wrapper identifying the connection to send to |
msg | the 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.
| Parameter | Description |
|---|---|
kws | the underlying websocket connection to send to |
msg | the message text to send |
getWebsockets(String type)
Returns: List<RepoAppWebsocket>
Finds every currently connected websocket registered for the given channel type.
| Parameter | Description |
|---|---|
type | the 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.
| Parameter | Description |
|---|---|
type | the channel type to look up connections for |
itemId | the 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.
| Parameter | Description |
|---|---|
pb | the user to check |
type | the channel type to check |
itemId | the 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.
| Parameter | Description |
|---|---|
user | the user to check |
type | the channel type to check |
itemId | the 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.
| Parameter | Description |
|---|---|
profile | the profile to check |
type | the channel type to check |
itemId | the item id to check |