Interface IWebSocketConnection
-
- All Known Implementing Classes:
AbstractWebSocketConnection
public interface IWebSocketConnectionCommon interface for native WebSocket connections- Since:
- 6.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose(int code, java.lang.String reason)Closes the underlying web socket connectionorg.apache.wicket.ApplicationgetApplication()IKeygetKey()java.lang.StringgetSessionId()booleanisOpen()IWebSocketConnectionsendMessage(byte[] message, int offset, int length)Sends a binary message to the client.IWebSocketConnectionsendMessage(java.lang.String message)Sends a text message to the client.voidsendMessage(IWebSocketPushMessage message)Broadcasts a push message to the wicket page (and it's components) associated with this connection.
-
-
-
Method Detail
-
isOpen
boolean isOpen()
- Returns:
truewhen the underlying native web socket connection is still open.
-
close
void close(int code, java.lang.String reason)Closes the underlying web socket connection- Parameters:
code- the status codereason- the reason to close the connection
-
sendMessage
IWebSocketConnection sendMessage(java.lang.String message) throws java.io.IOException
Sends a text message to the client.- Parameters:
message- the text message- Returns:
thisobject, for chaining methods- Throws:
java.io.IOException- when an IO error occurs during the write to the client
-
sendMessage
IWebSocketConnection sendMessage(byte[] message, int offset, int length) throws java.io.IOException
Sends a binary message to the client.- Parameters:
message- the binary messageoffset- the offset to read fromlength- how much data to read- Returns:
thisobject, for chaining methods- Throws:
java.io.IOException- when an IO error occurs during the write to the client
-
sendMessage
void sendMessage(IWebSocketPushMessage message)
Broadcasts a push message to the wicket page (and it's components) associated with this connection. The components can then send messages or component updates to client by adding them to the target.- Parameters:
message- the push message to send- Since:
- 6.4
-
getApplication
org.apache.wicket.Application getApplication()
- Returns:
- The application for which this WebSocket connection is registered
-
getSessionId
java.lang.String getSessionId()
- Returns:
- The id of the session for which this WebSocket connection is registered
-
getKey
IKey getKey()
- Returns:
- The registry key for which this WebSocket connection is registered
-
-