Package marauroa.server.net.web
Class WebSocketChannel
java.lang.Object
org.eclipse.jetty.websocket.api.WebSocketAdapter
marauroa.server.net.web.WebSocketChannel
- All Implemented Interfaces:
org.eclipse.jetty.websocket.api.WebSocketListener
,org.eclipse.jetty.websocket.api.WriteCallback
public class WebSocketChannel
extends org.eclipse.jetty.websocket.api.WebSocketAdapter
implements org.eclipse.jetty.websocket.api.WriteCallback
a websocket connection to a client
- Author:
- hendrik
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
gets the ip-address and portgets the usernamevoid
onWebSocketClose(int statusCode, String reason)
void
onWebSocketConnect(org.eclipse.jetty.websocket.api.Session sess)
void
onWebSocketError(Throwable cause)
void
onWebSocketText(String message)
void
sendMessage(String json)
sends a message to the clientvoid
writeFailed(Throwable e)
void
Methods inherited from class org.eclipse.jetty.websocket.api.WebSocketAdapter
getRemote, getSession, isConnected, isNotConnected, onWebSocketBinary
-
Constructor Details
-
WebSocketChannel
public WebSocketChannel()
-
-
Method Details
-
onWebSocketConnect
public void onWebSocketConnect(org.eclipse.jetty.websocket.api.Session sess)- Specified by:
onWebSocketConnect
in interfaceorg.eclipse.jetty.websocket.api.WebSocketListener
- Overrides:
onWebSocketConnect
in classorg.eclipse.jetty.websocket.api.WebSocketAdapter
-
onWebSocketText
- Specified by:
onWebSocketText
in interfaceorg.eclipse.jetty.websocket.api.WebSocketListener
- Overrides:
onWebSocketText
in classorg.eclipse.jetty.websocket.api.WebSocketAdapter
-
onWebSocketClose
- Specified by:
onWebSocketClose
in interfaceorg.eclipse.jetty.websocket.api.WebSocketListener
- Overrides:
onWebSocketClose
in classorg.eclipse.jetty.websocket.api.WebSocketAdapter
-
onWebSocketError
- Specified by:
onWebSocketError
in interfaceorg.eclipse.jetty.websocket.api.WebSocketListener
- Overrides:
onWebSocketError
in classorg.eclipse.jetty.websocket.api.WebSocketAdapter
-
getAddress
gets the ip-address and port- Returns:
- address
-
getUsername
gets the username- Returns:
- username
-
sendMessage
sends a message to the client- Parameters:
json
- json string to send
-
close
public void close() -
writeFailed
- Specified by:
writeFailed
in interfaceorg.eclipse.jetty.websocket.api.WriteCallback
-
writeSuccess
public void writeSuccess()- Specified by:
writeSuccess
in interfaceorg.eclipse.jetty.websocket.api.WriteCallback
-