public class JavaxWebSocketConnection extends AbstractWebSocketConnection
Constructor and Description |
---|
JavaxWebSocketConnection(javax.websocket.Session session,
AbstractWebSocketProcessor webSocketProcessor)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close(int code,
String reason)
Closes the underlying web socket connection
|
boolean |
isOpen() |
IWebSocketConnection |
sendMessage(byte[] message,
int offset,
int length)
Sends a binary message to the client.
|
IWebSocketConnection |
sendMessage(String message)
Sends a text message to the client.
|
sendMessage
public JavaxWebSocketConnection(javax.websocket.Session session, AbstractWebSocketProcessor webSocketProcessor)
session
- the WebSocket sessionpublic boolean isOpen()
true
when the underlying native web socket
connection is still open.public void close(int code, String reason)
IWebSocketConnection
code
- the status codereason
- the reason to close the connectionpublic IWebSocketConnection sendMessage(String message) throws IOException
IWebSocketConnection
message
- the text messagethis
object, for chaining methodsIOException
- when an IO error occurs during the write to the clientpublic IWebSocketConnection sendMessage(byte[] message, int offset, int length) throws IOException
IWebSocketConnection
message
- the binary messageoffset
- the offset to read fromlength
- how much data to readthis
object, for chaining methodsIOException
- when an IO error occurs during the write to the clientCopyright © 2006–2022 Apache Software Foundation. All rights reserved.