Click here to Skip to main content
15,907,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,

I am using autobahn websocket[^] to create communication between my server and android client. When I hosted my web socket on my site IIS and connect from my android, it is working fine.
Site URL to connect: "ws://".

But when I connect it to same server through Local Area Network with IP Address, I got problem. Connection was opened. Then it closed with the error "Websocket protocol violation".
LAN URL to connect: "ws://[MyApplicationName_ON_IIS]/WSockets/WSHttpHandler.ashx?name=android". URL should be correct because connection can be openned. But why it was closed?

This is what I found on autobahn website about this error -
Autobahn will NOT validate the bytes of a text payload being sent for actually being valid UTF8. You MUST ensure that you only provide valid UTF8 when sending text messages. If you produce invalid UTF8, a conforming WebSocket peer will close the WebSocket connection due to the protocol violation.

But I don't know what to do my payload with UTF8.

In my websocket handler, when client connected, I just Broadcast the message like below.
public override void OnOpen()
       = this.WebSocketContext.QueryString["name"];
                clients.Broadcast(name + " has connected.");
            catch (Exception ex)
                throw ex;

And it is working perfectly when I connect through WAN.

Please advise.

Thanks in advanced

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900