public class WebSocketEndpoint
extends java.lang.Object
implements org.eclipse.jetty.websocket.WebSocket.OnTextMessage
Red (ltrnc) |
Red (ltrnc) |
org.eclipse.jetty.websocket.WebSocket.Connection, org.eclipse.jetty.websocket.WebSocket.FrameConnection, org.eclipse.jetty.websocket.WebSocket.OnBinaryMessage, org.eclipse.jetty.websocket.WebSocket.OnControl, org.eclipse.jetty.websocket.WebSocket.OnFrame, org.eclipse.jetty.websocket.WebSocket.OnTextMessage
Constructor and Description |
---|
WebSocketEndpoint(WebSocketService parentService)
Create a new WebSocketEndpoint with the given parent service.
|
Modifier and Type | Method and Description |
---|---|
void |
addParentService(WebSocketService service)
Add a parent WebSocketService of this endpoint.
|
org.eclipse.jetty.websocket.WebSocket.Connection |
getConnection()
Return the Connection object for this WebSocket.
|
boolean |
isOpen()
Return true if the connection is open; false otherwise.
|
void |
onClose(int statusCode,
java.lang.String statusMessage)
Upon close, set the connection to null.
|
void |
onMessage(java.lang.String message)
Notify the parent service about a new message.
|
void |
onOpen(org.eclipse.jetty.websocket.WebSocket.Connection connection)
Upon opening, save a reference to the connection.
|
void |
removeParentService(WebSocketService service)
Remove a parent WebSocketService of this endpoint.
|
public WebSocketEndpoint(WebSocketService parentService)
parentService
- The WebSocketService to be notified of messages.public void addParentService(WebSocketService service)
service
- A parent WebSocketService of this endpoint.removeParentService(WebSocketService)
public org.eclipse.jetty.websocket.WebSocket.Connection getConnection()
public boolean isOpen()
public void onClose(int statusCode, java.lang.String statusMessage)
onClose
in interface org.eclipse.jetty.websocket.WebSocket
statusCode
- The status code of the closed connection.statusMessage
- The status message of the closed connection.public void onMessage(java.lang.String message)
onMessage
in interface org.eclipse.jetty.websocket.WebSocket.OnTextMessage
message
- The message that was received.public void onOpen(org.eclipse.jetty.websocket.WebSocket.Connection connection)
onOpen
in interface org.eclipse.jetty.websocket.WebSocket
connection
- The connection that was opened.public void removeParentService(WebSocketService service)
service
- A parent WebSocketService of this endpoint.addParentService(WebSocketService)