universe.test
Class ChatServer

java.lang.Object
  extended by universe.Universe<java.lang.String>
      extended by universe.test.ChatServer

public class ChatServer
extends Universe<java.lang.String>

Universe ChatServer test. Implements a Simple Server that broadcasts messages (strings) to all connected clients.


Field Summary
 
Fields inherited from class universe.Universe
DEFAULT_TICK_RATE
 
Method Summary
static void main(java.lang.String[] s)
          Main method.
 Bundle<java.lang.String> onDisconnect(IWorld w)
          When a client disconnects, remove the world and send a message
 Scene onDraw()
          Nothing to draw
 Bundle<java.lang.String> onMsg(IWorld w, java.lang.String m)
          When a message arrives, broadcast it to all connected clients
 Bundle<java.lang.String> onNew(IWorld w)
          When a new client arrives, add it to the current list
 
Methods inherited from class universe.Universe
onTick, tickRate, universe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] s)
Main method. Starts the server/universe


onDraw

public Scene onDraw()
Nothing to draw

Specified by:
onDraw in class Universe<java.lang.String>

onMsg

public Bundle<java.lang.String> onMsg(IWorld w,
                                      java.lang.String m)
When a message arrives, broadcast it to all connected clients

Overrides:
onMsg in class Universe<java.lang.String>

onNew

public Bundle<java.lang.String> onNew(IWorld w)
When a new client arrives, add it to the current list

Overrides:
onNew in class Universe<java.lang.String>

onDisconnect

public Bundle<java.lang.String> onDisconnect(IWorld w)
When a client disconnects, remove the world and send a message

Overrides:
onDisconnect in class Universe<java.lang.String>