Starscream: How to debug "Invalid HTTP upgrade" issue

Created on 27 Feb 2017  路  1Comment  路  Source: daltoniam/Starscream

let socket = WebSocket(url: URL(string: "wss://api.lionshare.capital")!)
Have tested on HTML it connects correctly, but when I use Starscream, I get the Invalid HTTP upgrade error. Do you have any suggestions on how to debug the issue? Or are there any iOS specific settings / formats it needs to adhere too?
Using Starscream:2.0.3 XCode:8.2.1.

Most helpful comment

Invalid upgrade comes from the server when it fails to upgrade the HTTP/TCP connection to a WebSocket connection. I would double check your url, your headers and such, so the server has the correct info to properly upgrade the connection. If that looks correct, I would suggest a packet capture to see what the differences, so you can make the needed code changes to match. Also be sure to check your Origin header, as most WebSocket servers will reject any connection that doesn't match.

>All comments

Invalid upgrade comes from the server when it fails to upgrade the HTTP/TCP connection to a WebSocket connection. I would double check your url, your headers and such, so the server has the correct info to properly upgrade the connection. If that looks correct, I would suggest a packet capture to see what the differences, so you can make the needed code changes to match. Also be sure to check your Origin header, as most WebSocket servers will reject any connection that doesn't match.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marknorgren picture marknorgren  路  5Comments

blajivskiy picture blajivskiy  路  6Comments

francos picture francos  路  3Comments

Dezabro picture Dezabro  路  3Comments

gmosx picture gmosx  路  4Comments