germanium-0UDz38MK/
2013-01-04 11:20:37 UTC
Hi, I'm writing a websocket-to-socket proxy for the spice html5 client
(http://www.spice-space.org/page/Html5) using this websocket package:
http://godoc.org/code.google.com/p/go.net/websocket
I'm using it just like in the Handler example in the doc, using Read and
Write on the *websocket.Conn (I'm really new to websockets).
The spice html5 client requires the binary subprotocol and it fails upon
the first encounter of a text frame (opcode 0x1).
The client handshake contains "Sec-WebSocket-Protocol: binary" but the
server handshake doesn't (meaning that it doesn't agree on it) and all my
writings to the *websocket.Conn become text frames.
How do I make them binary frames (opcode 0x2)?
Setting ws.Config().Protocol to []string{"binary"} in the Handler has no
effect (ws being the *websocket.Conn).
from code.google.com/p/go/source/browse/websocket/server.go:
15 config := new(Config)
16 var hs serverHandshaker = &hybiServerHandshaker{Config: config}
...
41 config.Protocol = nil
42
43 err = hs.AcceptHandshake(buf.Writer)
I can see that AcceptHandshake will always find hs.Protocol == nil,
therefore it will never write a Sec-WebSocket-Protocol field. Is it
intended to never agree on the client requested protocol? Am I missing
something?
I don't seem to have problems decoding binary frames from the client.
Thanks,
Leo III
--
(http://www.spice-space.org/page/Html5) using this websocket package:
http://godoc.org/code.google.com/p/go.net/websocket
I'm using it just like in the Handler example in the doc, using Read and
Write on the *websocket.Conn (I'm really new to websockets).
The spice html5 client requires the binary subprotocol and it fails upon
the first encounter of a text frame (opcode 0x1).
The client handshake contains "Sec-WebSocket-Protocol: binary" but the
server handshake doesn't (meaning that it doesn't agree on it) and all my
writings to the *websocket.Conn become text frames.
How do I make them binary frames (opcode 0x2)?
Setting ws.Config().Protocol to []string{"binary"} in the Handler has no
effect (ws being the *websocket.Conn).
from code.google.com/p/go/source/browse/websocket/server.go:
15 config := new(Config)
16 var hs serverHandshaker = &hybiServerHandshaker{Config: config}
...
41 config.Protocol = nil
42
43 err = hs.AcceptHandshake(buf.Writer)
I can see that AcceptHandshake will always find hs.Protocol == nil,
therefore it will never write a Sec-WebSocket-Protocol field. Is it
intended to never agree on the client requested protocol? Am I missing
something?
I don't seem to have problems decoding binary frames from the client.
Thanks,
Leo III
--