Socket.io (Websocket) Client Example

nwgarner
Posts: 1
Joined: Mon Jun 05, 2017 6:47 am

Socket.io (Websocket) Client Example

Postby nwgarner » Mon Jun 05, 2017 6:54 am

Hello Everyone,
Are there any examples for connecting to a websocket server from ESP-32 IDF? There's numerous examples of running a websocket server on the ESP-32, just can't seem to find the inverse.

Thank you,
Nick

User avatar
Scalpel78
Posts: 51
Joined: Sun Feb 26, 2017 7:31 am

Re: Socket.io (Websocket) Client Example

Postby Scalpel78 » Wed Jun 07, 2017 3:31 pm

I'm really interrested in this as well!

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Socket.io (Websocket) Client Example

Postby kolban » Wed Jun 07, 2017 3:41 pm

Imagine the question was being asked in a "Linux" environment. What libraries/tools/technologies would you consider to be the one(s) you would want to use? If we (community) can find an API on Linux, then we can perhaps undertake a task to attempt the goal in the ESP32 environment.

What sub platforms of ESP32 would be desired to be supported?

* ESP-IDF
* C++ using ESP-IDF
* C++ using Arduino
* Other languages ...
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
Scalpel78
Posts: 51
Joined: Sun Feb 26, 2017 7:31 am

Re: Socket.io (Websocket) Client Example

Postby Scalpel78 » Wed Jun 07, 2017 3:47 pm

Socket.io actually has a C++ client example here:

https://github.com/socketio/socket.io-client-cpp

Perhaps it can work on ESP32?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Socket.io (Websocket) Client Example

Postby kolban » Thu Jun 08, 2017 4:27 am

I was looking through some docs on Mongoose networking. This is a library which is known to work fine with ESP32 ESP-IDF. Reading the docs, it seems to have outbound WS support. See:

https://docs.cesanta.com/mongoose/maste ... ect_ws.md/
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

kurtzweber
Posts: 60
Joined: Tue Jan 10, 2017 1:09 pm

Re: Socket.io (Websocket) Client Example

Postby kurtzweber » Fri Jun 09, 2017 11:46 am

Hi

just note that websocket and socket.io are different things... you cannot connect to a socket.io server using a "generic" websocket client:

https://en.wikipedia.org/wiki/Socket.IO

so if your goal is to implement a connection from ESP32 to a Socket.IO server you have to implement the full "socket.io" protocol... some clients (including a C++ and java implementation) are available in the official repo:
https://github.com/socketio

Who is online

Users browsing this forum: No registered users and 25 guests