|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.starhope.vergil.net.WebSocketServerConnection
public class WebSocketServerConnection
implementation of ServerConnection using WebSocket
| Field Summary | |
|---|---|
private String |
host
WRITEME: Document this brpocock@star-hope.org |
private int |
port
WRITEME: Document this brpocock@star-hope.org |
private WebSocket |
socket
The WebSocket connection |
private String |
zone
WRITEME: Document this brpocock@star-hope.org |
| Constructor Summary | |
|---|---|
WebSocketServerConnection()
|
|
| Method Summary | |
|---|---|
void |
connect(String newHost,
int newPort,
String newZone)
Connect to a game server |
void |
disconnect()
Disconnect. |
String |
getHost()
|
int |
getPort()
|
String |
getZone()
|
com.google.gwt.json.client.JSONObject |
readMessage()
Retrieve the next message from the server's queue, or null if there are no messages waiting |
com.google.gwt.json.client.JSONObject |
readMessageBlocking()
Retrieves the next message from the server, blocking to wait for one if there are none queued. |
void |
sendMessage(com.google.gwt.json.client.JSONObject jso)
Send a message to the server |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private WebSocket socket
private String host
private int port
private String zone
| Constructor Detail |
|---|
public WebSocketServerConnection()
| Method Detail |
|---|
public void connect(String newHost,
int newPort,
String newZone)
throws IOException,
ServerDisconnectedException
ServerConnection
connect in interface ServerConnectionnewHost - host name or IP address (in whatever notation the
local networking code understands)newPort - TCP (or UDP…?) port numbernewZone - the zone on that port, to which to connect ($Eden
is login zone)
IOException - if some kind of problem prevents a
connection; subclasses might make sense to the local
code, to be able to provide better diagnostic
information for the end-user
ServerDisconnectedException - if the connection is lost
(but was basically established)ServerConnection.connect(java.lang.String,
int, java.lang.String)public void disconnect()
ServerConnection
disconnect in interface ServerConnectionServerConnection.disconnect()public String getHost()
getHost in interface ServerConnectionServerConnection.getHost()public int getPort()
getPort in interface ServerConnectionServerConnection.getPort()public String getZone()
getZone in interface ServerConnectionServerConnection.getZone()
public com.google.gwt.json.client.JSONObject readMessage()
throws ServerDisconnectedException
ServerConnection
readMessage in interface ServerConnectionServerDisconnectedException - if the connection is lostTODO:
is this blocking? I forget.
public com.google.gwt.json.client.JSONObject readMessageBlocking()
throws ServerDisconnectedException
ServerConnection
readMessageBlocking in interface ServerConnectionServerDisconnectedException - if the connection is lostServerConnection.readMessageBlocking()
public void sendMessage(com.google.gwt.json.client.JSONObject jso)
throws ServerDisconnectedException
ServerConnection
sendMessage in interface ServerConnectionjso - JSON data
ServerDisconnectedException - if the connection is lostServerConnection.sendMessage(com.google.gwt.json.client.JSONObject)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||