org.starhope.appius.net
Class WebSocketProcessor

java.lang.Object
  extended by java.lang.Thread
      extended by org.starhope.appius.net.NetIOThread
          extended by org.starhope.appius.net.ServerThread
              extended by org.starhope.appius.net.StreamProcessor
                  extended by org.starhope.appius.net.WebSocketProcessor
All Implemented Interfaces:
Comparable<Thread>, Runnable, Thread.UncaughtExceptionHandler, NetIOHandlerPeer, ServerProcessor, AcceptsMetronomeTicks, HasName, CanProcessCommands

public class WebSocketProcessor
extends StreamProcessor

WRITEME: Document this type.

Author:
brpocock@star-hope.org

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  WebSocket mySocket
          WRITEME: Document this brpocock@star-hope.org
private  String myURI
          WRITEME: Document this brpocock@star-hope.org
 
Fields inherited from class org.starhope.appius.net.ServerThread
busyState, futureDatagrams, idleWarned, keepRunning, lastInputTime, loggedIn, maxInputSize, myUser, preloginCountdown, randomKey, streamProtocolLanguage, tLastNudge, zone
 
Fields inherited from class org.starhope.appius.net.NetIOThread
debug, dialect, in, isDone, language, letsPlayWithFlash, out, parallelMode, socket, state
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WebSocketProcessor(WebSocket newSocket, String requestURI)
          Ctor
 
Method Summary
protected  void checkInputStream()
          Peek for input.
protected  void doNudge(long t)
          Nudge the user to see if they're dead yet
protected  void dropSocket_socketCore()
          The core code that actually disconnects the socket hard.
protected  void dropSocketConnection()
          Drop the I/O socket for this user.
 String getIPAddress()
           
protected  String getRemoteAddress()
           
protected  Socket getSocket()
          Get the socket connection to the pipe
protected  Socket getStreamsReady()
          WRITEME: Document this method brpocock@star-hope.org
protected  String grabInput()
          Get input from the client stream
 void run()
          Run the server thread connected to a client
 
Methods inherited from class org.starhope.appius.net.ServerThread
adopt, areYouThere, close, commandJSON, disconnectDuplicate, doProcessing, doRealClose, end, enterZone, enterZone, equals, failLogin, finalize, genRandomKey, getApple, getIpAddress, getLanguage, getRandomKey, getRandomKey, getSFSVersion, getStreamProtocolLanguage, getUser, getZone, hashCode, isLoggedIn, kickDuplicates, kickDuplicates, logIn_checkPassword, logIn_checkUserAllowed, logIn_loadTest_autoCreateFakeUser, logIn, logout, migrate, postLogIn, processInput_Infinity, processInput_SmartFoxServer, processJSONInput, processJSONPreLogin, processPreLogin, processXMLInput, sendAdminDisconnect, sendAdminMessage, sendAdminMessage, sendBadPassword, sendDeferredDatagrams, sendErrorReply, sendFutureDatagrams, sendGameActionMessage, sendLoginPacket, sendLogKO, sendLogKO, sendNextFutureDatagram, sendNoSuchUser, sendPrivateMessage, sendPublicMessage, sendRawMessage, sendRawMessageLater, sendResponse, sendResponse, sendResponse, sendResponse, sendResponse, sendResponseRemote, sendRoomEnteredByUser, sendRoomList, sendRoomList, sendRoomPartedBy, sendRoomUserCount, sendRoomVar, sendSuccessReply, sendUserJoin, sendUserPart, sendUserVariable, setBusyState, setLanguage, setLastInputTime, setLoggedIn, setParallelMode, setSFSVersion, setup, sha1hexify, tattlePrefix, tick_checkIdleKick, tick_checkIdleWarnTime, tick, toInfinityAndBeyond, toString, uncaughtException, userDebug
 
Methods inherited from class org.starhope.appius.net.NetIOThread
compareTo, equals, getLanguage_dialect, getVerboseBugReplies, isDebug, isParallelMode, processInput, sendError_RAW, sendRawMessageNow, setDebug, setLanguage, setVerboseBugReplies, superVerbose, tattle, tattle
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.starhope.appius.net.ServerProcessor
start
 
Methods inherited from interface org.starhope.appius.util.HasName
getName
 
Methods inherited from interface org.starhope.util.types.CanProcessCommands
getName
 

Field Detail

mySocket

private final WebSocket mySocket
WRITEME: Document this brpocock@star-hope.org


myURI

private final String myURI
WRITEME: Document this brpocock@star-hope.org

Constructor Detail

WebSocketProcessor

public WebSocketProcessor(WebSocket newSocket,
                          String requestURI)
Ctor

Parameters:
newSocket - socket
requestURI - request URI
Method Detail

checkInputStream

protected void checkInputStream()
                         throws UserDeadException
Description copied from class: NetIOThread
Peek for input. Try to throw an I/O exception.

Overrides:
checkInputStream in class NetIOThread
Throws:
UserDeadException - if the remote user has disconnected
See Also:
NetIOThread.checkInputStream()

doNudge

protected void doNudge(long t)
                throws UserDeadException
Description copied from class: ServerThread
Nudge the user to see if they're dead yet

Overrides:
doNudge in class ServerThread
Parameters:
t - the current time
Throws:
UserDeadException - if they are, in fact, dead
See Also:
ServerThread.doNudge(long)

dropSocket_socketCore

protected void dropSocket_socketCore()
Description copied from class: NetIOThread
The core code that actually disconnects the socket hard.

Overrides:
dropSocket_socketCore in class NetIOThread
See Also:
NetIOThread.dropSocket_socketCore()

dropSocketConnection

protected void dropSocketConnection()
Description copied from class: NetIOThread
Drop the I/O socket for this user.

Overrides:
dropSocketConnection in class NetIOThread
See Also:
NetIOThread.dropSocketConnection()

getIPAddress

public String getIPAddress()
Overrides:
getIPAddress in class ServerThread
Returns:
The string form of the client's IP address (may be IPv4 or IPv6)
See Also:
ServerThread.getIPAddress()

getRemoteAddress

protected String getRemoteAddress()
Overrides:
getRemoteAddress in class NetIOThread
Returns:
the string form of the remote address
See Also:
NetIOThread.getRemoteAddress()

getSocket

protected Socket getSocket()
Description copied from class: NetIOThread
Get the socket connection to the pipe

Overrides:
getSocket in class NetIOThread
Returns:
the socket connection to the pipe
See Also:
NetIOThread.getSocket()

getStreamsReady

protected Socket getStreamsReady()
                          throws UserDeadException,
                                 IOException
Description copied from class: ServerThread
WRITEME: Document this method brpocock@star-hope.org

Overrides:
getStreamsReady in class ServerThread
Returns:
WRITEME
Throws:
UserDeadException - WRITEME
IOException - WRITEME
See Also:
ServerThread.getStreamsReady()

grabInput

protected String grabInput()
                    throws UserDeadException
Description copied from class: ServerThread
Get input from the client stream

Overrides:
grabInput in class ServerThread
Returns:
the input from the client
Throws:
UserDeadException - if the user disconnects
See Also:
ServerThread.grabInput()

run

public void run()
Description copied from class: ServerThread
Run the server thread connected to a client

Specified by:
run in interface Runnable
Overrides:
run in class ServerThread
See Also:
ServerThread.run()