@WebSocket
public class MetisWebSocket
extends java.lang.Object
Constructor and Description |
---|
MetisWebSocket()
Create a client socket
|
MetisWebSocket(PeerServlet peerServlet)
Create a server socket
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the WebSocket
|
void |
doMetisPost(java.lang.String request)
Process a POST request by sending the request message and then
waiting for a response.
|
java.net.InetSocketAddress |
getRemoteAddress()
Return the remote address for this connection
|
boolean |
isOpen()
Check if we have a WebSocket connection
|
void |
onClose(int statusCode,
java.lang.String reason)
WebSocket session has been closed
|
void |
onConnect(org.eclipse.jetty.websocket.api.Session session)
WebSocket connection complete
|
boolean |
startClient(java.net.URI uri)
Start a client session
|
public MetisWebSocket()
public MetisWebSocket(PeerServlet peerServlet)
peerServlet
- Servlet for request processingpublic boolean startClient(java.net.URI uri) throws java.io.IOException
uri
- Server URIjava.io.IOException
- I/O error occurred@OnWebSocketConnect public void onConnect(org.eclipse.jetty.websocket.api.Session session)
session
- WebSocket sessionpublic boolean isOpen()
public java.net.InetSocketAddress getRemoteAddress()
public void doMetisPost(java.lang.String request) throws java.io.IOException
request
- Request messagejava.io.IOException
- I/O error occurred@OnWebSocketClose public void onClose(int statusCode, java.lang.String reason)
statusCode
- Status codereason
- Reason messagepublic void close()