Skip to content

Instantly share code, notes, and snippets.

@casualjim
Created April 8, 2011 18:08
Show Gist options
  • Save casualjim/910404 to your computer and use it in GitHub Desktop.
Save casualjim/910404 to your computer and use it in GitHub Desktop.
package com.mojolly.backchat
package web
class MySocketIOClient extends Client {
def receive = {
case Connected => {
}
case Message(msg) => {
//handlePlainTextMessage
}
case JsonMessage(msg) => //handleJsonMessage(msg)
case Disconnected(_, _) => {
// do stuff on disconnect
}
case m => log.warn("Unknown message format found: %s", m)
}
}
class SocketIOApp extends ScalatraServlet with SocketIOSupport with Logging {
get("/?") {
"Hello, I don't do anything but serve websockets. Visit https://backchat.io for more information."
}
connect {
new MySocketIOClient
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment