in my android application I want to use the autobahn library to use websockets.
I think the server is using draft-17. Can someone tell me, how to set up the Client to use this protocol?
I have this code:
mConnection.connect(url,new String[] {"protocolname?"}, new WebSocketHandler() {
//some functions
},options);
Greetings
UPDATE On my server I use Jetty in version 8.1.
UPDATE the output from LogCat is:
01-15 22:54:53.481: D/de.tavendo.autobahn.WebSocketReader(32452): created
01-15 22:54:53.491: D/de.tavendo.autobahn.WebSocketConnection(32452): WS reader created and started
01-15 22:54:53.491: D/de.tavendo.autobahn.WebSocketReader(32452): running
01-15 22:54:53.491: D/de.tavendo.autobahn.WebSocketWriter(32452): created
01-15 22:54:53.491: D/de.tavendo.autobahn.WebSocketConnection(32452): WS writer created and started
01-15 22:54:53.551: D/de.tavendo.autobahn.WebSocketConnection(32452): opening handshake received
01-15 22:54:53.551: D/Websocket(32452): Status: Connected to ws://192.168.178.30:8080
01-15 22:54:53.551: D/de.tavendo.autobahn.WebSocketReader(32452): run() : WebSocketException (de.tavendo.autobahn.WebSocketException: RSV != 0 and no extension negotiated)
01-15 22:54:53.551: D/de.tavendo.autobahn.WebSocketReader(32452): ended
01-15 22:54:53.551: D/de.tavendo.autobahn.WebSocketConnection(32452): fail connection [code = 4, reason = WebSockets protocol violation
01-15 22:54:53.551: D/de.tavendo.autobahn.WebSocketReader(32452): quit
01-15 22:54:53.551: D/de.tavendo.autobahn.WebSocketWriter(32452): ended
01-15 22:54:53.551: D/Websocket(32452): Connection lost.
01-15 22:54:53.551: D/de.tavendo.autobahn.WebSocketConnection(32452): worker threads stopped
Are you referring to WebSocket protocol version or WebSocket subprotocols?
Regarding the former: AutobahnAndroid implements RFC6455 (the last and final WebSocket protocol version). There is no way to downgrade to older versions, but basically, there haven't been significant changes from Hybi-10+ to RFC6455.
Regarding the latter: WebSocket subprotocols are specified when opening the WebSocket connection like this.