Starscream: Error: Invalid HTTP upgrade

Hi,

I have random connection problem which display these logs:

websocket is connected
websocket is disconnected: "Invalid HTTP upgrade"

code:

    let useSSL = true
    let websocketScheme = "wss"
    let host = "x.x.x.x"
    let port: NSNumber = 8080

    public init() {
        let components = NSURLComponents()
        components.scheme = websocketScheme
        components.host = host
        components.port = port
        components.path = "/"

        webSocket = WebSocket(url: components.URL!)
        webSocket?.selfSignedSSL = useSSL
        webSocket?.delegate = self
        webSocket?.connect()
    }

It happens on iOS 9.0.1 (iPads). With swift 1.x and Xcode 6.x everything worked well, but now it randomly failed. Please give me some suggestion. Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 21 (5 by maintainers)

Most upvoted comments

For what it’s worth, I get this http upgrade error constantly when using Starscream in an iOS Simulator in Mac, but my brief testing on an actual iOS device connected to the mac (not simulator) has not seen the error.