Commit 6c95b8b0 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

stub websocket server implementation

parent ba33f63d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -11,14 +11,19 @@ import org.eclipse.jetty.websocket.WebSocket.Connection

class WebSocket extends org.eclipse.jetty.websocket.WebSocket.OnTextMessage {

  def onOpen(conn: Connection) =
  var endpoint : Connection = null

  def onOpen(conn: Connection) = {
    endpoint = conn
    FnordMetric.log_debug("[WebSocket] connection opened")
  }

  def onClose(code: Int, message: String) =
    FnordMetric.log_debug("[WebSocket] connection closed")

  def onMessage(message: String) {
    println("received: " + message);
    val ins = InstructionFactory.parse(message)
    endpoint.sendMessage(ins.execute);
  }