I have been successfully writing a Go (server) websocket 'chat' application based in this example code
Both client and server work as expected.
When I have come to implement a client using Python's Autobahn I am running into trouble. it is based on this example
ws://localhost:8080/ws (which works in Chrome) yields an HTTP 1.0/400 from the server. ws://localhost:8080/ (does not work in Chrome) yields an HTTP 1.0/200 from the server (in both cases).
Scanning the source (I admit, I don't know the WS protocol) seems to imply that the server should be responding with a 101.
This is the output from Autobahn:
2013-05-19 15:33:10+0100 [Uninitialized] connection to 127.0.0.1:8080 established
2013-05-19 15:33:10+0100 [Uninitialized] GET /ws HTTP/1.1
User-Agent: AutobahnPython/0.5.14
Host: localhost:8080
Upgrade: WebSocket
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: ZCnYpz0fvahS10S9aQWyvA==
Sec-WebSocket-Version: 8
2013-05-19 15:33:10+0100 [Uninitialized] TX Octets to 127.0.0.1:8080 : sync = False, octets = 474554202f777320485454502f312e310d0a557365722d4167656e743a204175746f6261686e507974686f6e2f302e352e31340d0a486f73743a206c6f63616c686f73743a383038300d0a557067726164653a20576562536f636b65740d0a436f6e6e656374696f6e3a20557067726164650d0a507261676d613a206e6f2d63616368650d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a5365632d576562536f636b65742d4b65793a205a436e59707a306676616853313053396151577976413d3d0d0a5365632d576562536f636b65742d56657273696f6e3a20380d0a0d0a
2013-05-19 15:33:10+0100 [EchoClientProtocol,client] RX Octets from 127.0.0.1:8080 : octets = 485454502f312e31203430302042616420526571756573740d0a0d0a7061727365203a20656d7074792075726c
2013-05-19 15:33:10+0100 [EchoClientProtocol,client] received HTTP response:
HTTP/1.1 400 Bad Request
2013-05-19 15:33:10+0100 [EchoClientProtocol,client] received HTTP status line in opening handshake : HTTP/1.1 400 Bad Request
2013-05-19 15:33:10+0100 [EchoClientProtocol,client] received HTTP headers in opening handshake : {}
2013-05-19 15:33:10+0100 [EchoClientProtocol,client] failing WebSockets opening handshake ('WebSockets connection upgrade failed (400 - BadRequest)')
2013-05-19 15:33:10+0100 [EchoClientProtocol,client] dropping connection
2013-05-19 15:33:10+0100 [-] WebSocketProtocol.onClose:
wasClean=False
code=1006
reason=connection was closed uncleanly (None)
self.closedByMe=False
self.failedByMe=False
self.droppedByMe=True
self.wasClean=False
self.wasNotCleanReason=None
self.localCloseCode=None
self.localCloseReason=None
self.remoteCloseCode=None
self.remoteCloseReason=None
UPDATE: I have also tried against this sample Go code which is a very trivial echo server. This makes me even more suspicious of my Autobahn code.
UPDATE: Code, as requested:
package main
import (
"net/http"
"io"
"code.google.com/p/go.net/websocket"
)
func EchoServer(ws *websocket.Conn) {
io.Copy(ws, ws);
}
func main() {
http.Handle("/ws", websocket.Handler(EchoServer));
err := http.ListenAndServe(":8080", nil);
if err != nil {
panic("ListenAndServe: " + err.Error())
}
}