Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.89k stars 556 forks source link

Issue : WebsocketServer not connecting with ios websocket library #699

Open Murtaza7745 opened 3 years ago

Murtaza7745 commented 3 years ago

Hey there Markus, First of all, thankful to you for making this amazing WebSocket library for Arduino users. I am currently running the example of WebSocketSserver on esp32 and I am facing difficulty connecting an iPhone. The library I am using for ios is https://github.com/socketio/socket.io-client-swift The library is also updated. Maybe it has something to do with the Handshake key. I am in need of your help.

Awaiting your soon reply. Murtaza.

Links2004 commented 3 years ago

Hi, the WebsocketServer creates a plain websocket, but your ios lib expects socket.io on top of the websocket ;)

Murtaza7745 commented 3 years ago

Can you guide me how to do it?

Links2004 commented 3 years ago

the arduinoWebSockets only implements a socket.io client (like your ios lib) but no socket.io server. If you want to connect to the ESP you will need a websocket lib for ios to connect to the websocket server the ESP creates.

I am not a ios developer, but it looks like you can use the ios part from: https://www.raywenderlich.com/13209594-an-introduction-to-websockets and simple use the ESP as websocket server

Murtaza7745 commented 3 years ago

Hey, I tried the above and it works like a charm, just wondering if you have any reference for android as well, same as above.

Thanks again for the help.

Links2004 commented 3 years ago

Hi, the "reference" where the first google result for "IOS websocket client" ;)

https://github.com/TakahikoKawasaki/nv-websocket-client#sample-application