Go Websocket Server & Python Autobahn Client Conflict -
i have been writing go (server) websocket 'chat' application based in this example code
both client , server work expected.
when have come implement client using python's autobahn running trouble. based on this example
ws://localhost:8080/ws (which works in chrome) yields http 1.0/400 server. ws://localhost:8080/ (does not work in chrome) yields http 1.0/200 server (in both cases).
scanning source (i admit, don't know ws protocol) seems imply server should responding 101.
this output autobahn:
2013-05-19 15:33:10+0100 [uninitialized] connection 127.0.0.1:8080 established 2013-05-19 15:33:10+0100 [uninitialized] /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 127.0.0.1:8080 : sync = false, octets = 474554202f777320485454502f312e310d0a557365722d4167656e743a204175746f6261686e507974686f6e2f302e352e31340d0a486f73743a206c6f63616c686f73743a383038300d0a557067726164653a20576562536f636b65740d0a436f6e6e656374696f6e3a20557067726164650d0a507261676d613a206e6f2d63616368650d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a5365632d576562536f636b65742d4b65793a205a436e59707a306676616853313053396151577976413d3d0d0a5365632d576562536f636b65742d56657273696f6e3a20380d0a0d0a 2013-05-19 15:33:10+0100 [echoclientprotocol,client] rx octets 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 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: have tried against this sample go code trivial echo server. makes me more suspicious of autobahn code.
update: code, 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()) } }
Comments
Post a Comment