daltoniam / Starscream

Websockets in swift for iOS and OSX
Apache License 2.0
8.32k stars 1.21k forks source link

Can't seem to connect to Poloniex WSS API? #397

Closed johnalanwoods closed 7 years ago

johnalanwoods commented 7 years ago

Is there something I'm missing, or doing wrong here?

This is how I'm preparing the socket.

    self.socket = WebSocket(url: URL(string: "wss://api.poloniex.com")!, protocols: ["ticker"])

I get a disconnect delegate call with the error:

(Error Domain=WebSocket Code=400 "Invalid HTTP upgrade" UserInfo={NSLocalizedDescription=Invalid HTTP upgrade}

Maybe an issue on the Poloniex end? Their API looks like I'm using it correctly: https://m.poloniex.com/support/api/

Anyone been successful using Starscream and Poloniex?

johnalanwoods commented 7 years ago

FWIW its working with Autobahn

acmacalister commented 7 years ago

Looks like Poloniex is using WAMP, which is built on top of the WebSocket protocol. You might need to use WAMP specific library, such as https://github.com/iscriptology/swamp or implement some custom logic to support WAMP (maybe it has additional required headers for auth or something along those lines).