We've implemented WebSocket services in our asp.net project with Dot Net 4.5. Along the usual lines:
if (System.Web.HttpContext.Current.IsWebSocketRequest)
{
log.Debug("Accepting web socket connection");
System.Web.HttpContext.Current.AcceptWebSocketRequest(HandleClient);
}
else
{
log.Debug("Rejecting non web socket connection");
System.Web.HttpContext.Current.Response.StatusCode = 500;
}
We can successfully connect to this and have traffic in both directions with Chrome and IE on the desktop, with Chrome on Android devices, etc. with no problems. But when trying to hit it from any iOS device (iPod Touch, iPad, etc.), System.Web.HttpContext.Current.IsWebSocketRequest
is always false.
Therefore, it is currently not possible to service iOS clients with this component.
It is not a bug. The problem is that Safari for iOS 5 or earlier does not implement the final version of the WebSocket protocol that was standardised as RFC 6455.
According to caniuse.com, this is resolved in Safari for iOS 6:
http://caniuse.com/#search=websocket
You could try installing a beta of iOS 6 onto one of your devices to confirm this.
Clay.Fowler
0 Points
2 Posts
Unable to accept WebSocket connections from iOS mobile devices
Jul 27, 2012 05:00 PM|LINK
We've implemented WebSocket services in our asp.net project with Dot Net 4.5. Along the usual lines:
if (System.Web.HttpContext.Current.IsWebSocketRequest) { log.Debug("Accepting web socket connection"); System.Web.HttpContext.Current.AcceptWebSocketRequest(HandleClient); } else { log.Debug("Rejecting non web socket connection"); System.Web.HttpContext.Current.Response.StatusCode = 500; }We can successfully connect to this and have traffic in both directions with Chrome and IE on the desktop, with Chrome on Android devices, etc. with no problems. But when trying to hit it from any iOS device (iPod Touch, iPad, etc.), System.Web.HttpContext.Current.IsWebSocketRequest is always false.
Therefore, it is currently not possible to service iOS clients with this component.
Is this a known bug?
Paul Batum
Member
46 Points
8 Posts
Re: Unable to accept WebSocket connections from iOS mobile devices
Jul 28, 2012 11:41 PM|LINK
It is not a bug. The problem is that Safari for iOS 5 or earlier does not implement the final version of the WebSocket protocol that was standardised as RFC 6455.
According to caniuse.com, this is resolved in Safari for iOS 6:
http://caniuse.com/#search=websocket
You could try installing a beta of iOS 6 onto one of your devices to confirm this.