public abstract class AbstractWebSocketProcessor extends Object implements IWebSocketProcessor
Constructor and Description |
---|
AbstractWebSocketProcessor(javax.servlet.http.HttpServletRequest request,
WebApplication application)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
broadcastMessage(IWebSocketMessage message)
Exports the Wicket thread locals and broadcasts the received message from the client to all
interested components and behaviors in the page with id
#pageId |
protected WebApplication |
getApplication() |
protected String |
getSessionId() |
void |
onClose(int closeCode,
String message)
A notification after the close of the web socket connection.
|
protected void |
onConnect(IWebSocketConnection connection)
A helper that registers the opened connection in the application-level registry.
|
void |
onError(Throwable t)
A notification after a communication error.
|
void |
onMessage(byte[] data,
int offset,
int length)
Called when a binary message arrives from the client
|
void |
onMessage(String message)
Called when a text message arrives from the client
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onOpen
public AbstractWebSocketProcessor(javax.servlet.http.HttpServletRequest request, WebApplication application)
request
- the http request that was used to create this IWebSocketProcessor
application
- the current Wicket Applicationpublic void onMessage(String message)
IWebSocketProcessor
onMessage
in interface IWebSocketProcessor
message
- the text message from the clientpublic void onMessage(byte[] data, int offset, int length)
IWebSocketProcessor
onMessage
in interface IWebSocketProcessor
data
- the binary message from the clientoffset
- the offset to read fromlength
- how much data to readprotected final void onConnect(IWebSocketConnection connection)
connection
- the web socket connection to use to communicate with the clientIWebSocketProcessor.onOpen(Object)
public void onClose(int closeCode, String message)
IWebSocketProcessor
onClose
in interface IWebSocketProcessor
public void onError(Throwable t)
IWebSocketProcessor
onError
in interface IWebSocketProcessor
t
- The throwable for the communication problempublic final void broadcastMessage(IWebSocketMessage message)
#pageId
Note: ConnectedMessage and ClosedMessage messages are notification-only. I.e. whatever the components/behaviors write in the WebSocketRequestHandler will be ignored because the protocol doesn't expect response from the user.
message
- the message to broadcastprotected final WebApplication getApplication()
protected final String getSessionId()
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.