Interface IWebSocketConnection
- All Known Implementing Classes:
AbstractWebSocketConnection
,JavaxWebSocketConnection
public interface IWebSocketConnection
Common interface for native WebSocket connections
- Since:
- 6.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the underlying web socket connectiongetKey()
boolean
isOpen()
sendMessage
(byte[] message, int offset, int length) Sends a binary message to the client.sendMessage
(String message) Sends a text message to the client.void
sendMessage
(IWebSocketPushMessage message) Broadcasts a push message to the wicket page (and it's components) associated with this connection.sendMessageAsync
(byte[] message, int offset, int length) Sends a binary message to the client in an asynchronous way.sendMessageAsync
(byte[] message, int offset, int length, long timeout) Sends a binary message to the client in an asynchronous way.sendMessageAsync
(String message) Sends a text message to the client in an asynchronous way.sendMessageAsync
(String message, long timeout) Sends a text message to the client in an asynchronous way.void
sendMessageAsync
(IWebSocketPushMessage message) Broadcasts a push message to the wicket page (and it's components) associated with this connection.void
sendMessageAsync
(IWebSocketPushMessage message, long timeout) Broadcasts a push message to the wicket page (and it's components) associated with this connection.
-
Method Details
-
isOpen
boolean isOpen()- Returns:
true
when the underlying native web socket connection is still open.
-
close
Closes the underlying web socket connection- Parameters:
code
- the status codereason
- the reason to close the connection
-
sendMessage
Sends a text message to the client.- Parameters:
message
- the text message- Returns:
this
object, for chaining methods- Throws:
IOException
- when an IO error occurs during the write to the client
-
sendMessageAsync
Sends a text message to the client in an asynchronous way.- Parameters:
message
- the text message- Returns:
- a
Future
representing the send operation
-
sendMessageAsync
Sends a text message to the client in an asynchronous way.- Parameters:
message
- the text messagetimeout
- the timeout for operation- Returns:
- a
Future
representing the send operation
-
sendMessage
Sends a binary message to the client.- Parameters:
message
- the binary messageoffset
- the offset to read fromlength
- how much data to read- Returns:
this
object, for chaining methods- Throws:
IOException
- when an IO error occurs during the write to the client
-
sendMessageAsync
Sends a binary message to the client in an asynchronous way.- Parameters:
message
- the binary messageoffset
- the offset to read fromlength
- how much data to read- Returns:
- a
Future
representing the send operation
-
sendMessageAsync
Sends a binary message to the client in an asynchronous way.- Parameters:
message
- the binary messageoffset
- the offset to read fromlength
- how much data to readtimeout
- the timeout for operation- Returns:
- a
Future
representing the send operation
-
sendMessage
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
-
sendMessageAsync
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. Pushing to client is done asynchronously.- Parameters:
message
- the push message to send
-
sendMessageAsync
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. Pushing to client is done asynchronously.- Parameters:
message
- the push message to sendtimeout
- the timeout in milliseconds
-
getApplication
- Returns:
- The application for which this WebSocket connection is registered
-
getSessionId
- Returns:
- The id of the session for which this WebSocket connection is registered
-
getKey
- Returns:
- The registry key for which this WebSocket connection is registered
-