1

I'm running my ASP.NET Web API app locally with xsockets without any problems. When I publish the project to Azure, it won't connect. I enabled websockets for Azure and adjusted the xsockets url on the client side

from: conn = new XSockets.WebSocket("ws://localhost:50838/api/Chat");

to: conn = new XSockets.WebSocket("ws://.azurewebsites.net/api/Chat");

Any suggestions?

Arnoud

user1997332
  • 113
  • 1
  • 4

2 Answers2

1

XSockets passes in the subprotocol 'XSocketsNET' by default and for some reason Azure is filtering this away in the response. It works fine in emulation but on Azure the sub-protocol is removed. This causes errors in Chrome since chrome checks the subprotocol giving the error below:

WebSocket connection to 'ws://xmvc.azurewebsites.net/Home' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received

It works fine in other browser that does not perform this check. I've tried IE10 and Firefox on this sample site running XSockets on a Azure WebSite

In my opinion Chrome is doing the correct thing and Azure has a bug.

EDIT: Be aware of the fact that Azure WebSites limits websocket connections!!! Free site: 5 connections Shared site: 35 connections Standard site: 350 connections

Uffe
  • 2,275
  • 1
  • 13
  • 9
1

According to Microsoft using WebSockets over Wss / Https will do the trick, i just done a test and the result is still the same.

Most likely the "unnecessary" sub-protocol header is removed from the response event if you pass is from server during the hand-shake.

So, You cannot rely on the SubProtocol when using Windows Azure as it seems?

dathor
  • 174
  • 1
  • 3