tidwall / SwiftWebSocket

Fast Websockets in Swift for iOS and OSX
MIT License
1.53k stars 245 forks source link

socket.io 0.9 support? #77

Closed utdrmac closed 7 years ago

utdrmac commented 7 years ago

Since I can't get this to compile per #74, I'll ask if this library supports socket.io 0.9. I'm attempting to connect to the websocket of wikipedia and they only support 0.9 at the moment.

tidwall commented 7 years ago

I don't think so. SwitWebSocket only supports the Websocket protocol RFC-6455. As I understand Socket.IO is a wrapper API around Websockets. It's likely that you will need to find a specific library for Socket.IO.

utdrmac commented 7 years ago

Argh. I didn't realize that.

let ws = WebSocket("ws://stream.wikimedia.org/socket.io/1/")
...
**packet sniffing**
#########
T 10.10.10.17:54848 -> 208.80.153.248:80 [AP]
GET /socket.io/1/ HTTP/1.1.
Sec-WebSocket-Version: 13.
Connection: Upgrade.
Host: stream.wikimedia.org.
Origin: ws://stream.wikimedia.org/socket.io/1/.
User-Agent: SwiftWebSocket.
Upgrade: websocket.
Sec-WebSocket-Key: sIDxyjfm6UkA14UzJuIjiw==.
.

##
T 208.80.153.248:80 -> 10.10.10.17:54848 [AP]
HTTP/1.1 200 OK.
Server: nginx/1.4.6 (Ubuntu).
Date: Wed, 07 Dec 2016 17:53:18 GMT.
Content-Type: text/plain.
Content-Length: 90.
Connection: close.
Access-Control-Allow-Origin: ws://stream.wikimedia.org/socket.io/1/.
Access-Control-Allow-Credentials: true.
Access-Control-Allow-Methods: POST, GET, OPTIONS.
Access-Control-Max-Age: 3600.
.
0952375863066:60:60:websocket,xhr-multipart,htmlfile,jsonp-polling,flashsocket,xhr-polling
#####
tidwall commented 7 years ago

Perhaps this library? https://github.com/socketio/socket.io-client-swift

utdrmac commented 7 years ago

Their official Swift library is socket.io 1.0+ unfortunately. I'm gonna gripe at wikipedia for being almost 2 years behind the technology. Thanks!