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://mysite.com/WSockets/WSHttpHandler.ashx?name=android".
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://192.168.1.22/[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()
{
try
{
this.name = this.WebSocketContext.QueryString["name"];
clients.Add(this);
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
tslin