@Unstable
public abstract class AbstractXWikiEndpoint
extends javax.websocket.Endpoint
implements org.xwiki.websocket.EndpointComponent
Modifier and Type | Field and Description |
---|---|
protected org.xwiki.websocket.WebSocketContext |
context |
protected org.slf4j.Logger |
logger |
Constructor and Description |
---|
AbstractXWikiEndpoint() |
Modifier and Type | Method and Description |
---|---|
protected void |
close(javax.websocket.Session session,
javax.websocket.CloseReason.CloseCode closeCode,
String reasonPhrase)
Try to close the given session using the specified code and reason.
|
protected <T> void |
handleMessage(javax.websocket.Session session,
T message)
Handles a received message by calling either
onMessage(Session, T) or onMessage(T) . |
protected <T> void |
handleMessage(javax.websocket.Session session,
T message,
boolean last)
Handles a received message by calling either
onMessage(Session, T) or onMessage(T) . |
@Inject protected org.slf4j.Logger logger
@Inject protected org.xwiki.websocket.WebSocketContext context
protected <T> void handleMessage(javax.websocket.Session session, T message)
onMessage(Session, T)
or onMessage(T)
. If the value
returned by onMessage
matches the message type then we send it back.T
- the message typesession
- the WebSocket session in which the message was receivedmessage
- the received messageprotected <T> void handleMessage(javax.websocket.Session session, T message, boolean last)
onMessage(Session, T)
or onMessage(T)
. If the value
returned by onMessage
matches the message type then we send it back.T
- the message typesession
- the WebSocket session in which the message was receivedmessage
- the received messagelast
- whether this is the last message chunk or not, useful when handling partial messagesprotected void close(javax.websocket.Session session, javax.websocket.CloseReason.CloseCode closeCode, String reasonPhrase)
session
- the session to closecloseCode
- the error codereasonPhrase
- the reason to close the sessionCopyright © 2004–2021 XWiki. All rights reserved.