The Google GO team is working on a WebSocket server
As part of the very comprehensive suite of packages Google GO is bundled with, a WebSocket server seems to be in the works:
http://code.google.com/p/go/source/browse/src/pkg/websocket/
Makefile client.go server.go websocket.go websocket_test.go
This is how you define a handler in GO’s WebSocket:
package main
import (
"http"
"io"
"websocket"
)
// echo back the websocket.
func EchoServer(ws *websocket.Conn) {
io.Copy(ws, ws);
}
func main() {
http.Handle("/echo", websocket.Handler(EchoServer));
err := http.ListenAndServe(":12345", nil);
if err != nil {
panic("ListenAndServe: ", err.String())
}
}Using node.websocket.js, it’d boil down to starting up the server:
$ node runserver.js --port="12345"
and defining the modules/echo.js handler:
this.onData = function(data, conn){ conn.send(data); }
I’d be interested in seeing how well GO performs with many simultaneous, long-lived clients.