Single SubProtocol needed in header

#1

I need to use websocket subprotocols in my android application. The code is as follows:

String [] proto = {“proto”};
WebSocketOptions wso = new WebSocketOptions();

      try {

         mConnection.connect(wsuri, proto, new WebSocketHandler() {

            @Override

            public void onOpen() {

               Log.d(TAG, "Status: Connected to " + wsuri);

       			mConnection.sendTextMessage("info");

            }

           @Override

            public void onTextMessage(String payload) {

               Log.d(TAG, "Got echo: " + payload);

            }

           @Override

            public void onClose(int code, String reason) {

               Log.d(TAG, "Connection lost.");

            }

         },wso);

When I wireshark the connection as its being made, I notice the protocol listed as follows:

Sec-WebSocket-Protocol: proto, \r\n

The websocket server is refusing the connection because there is a comma after the letters

in proto(I can not change the server). If there is only a single protocol, why is the comma there ??

Is there a way around this ? Is there a different way to add the protocol ?

0 Likes

#2

Sec-WebSocket-Protocol: proto, \r\n

https://github.com/tavendo/AutobahnAndroid/issues/12

The fix is mentioned at the top of this ..

/Tobias

0 Likes