ArduinoWebsockets icon indicating copy to clipboard operation
ArduinoWebsockets copied to clipboard

WSS Server on ESP32

Open floolean opened this issue 4 years ago • 12 comments

Hi there, first, thank you for doing this, it seems a solid library to me.

My question: I didn’t see any examples of a secured websocket server for esp32 or any other, did I miss something or isnt there a way yet?

Thank you

floolean avatar Dec 17 '19 08:12 floolean

Hi, thank you for opening the issue.

There is no support for that currently, no one has ever requested it before so it wasn't on my backlog.

As the library gets more popular I assume more people will come here looking for this feature. I'll add it to the backlog, but it might take a while until I actually get to work on it.

Depending on the public need for this feature, I might prioritize it over other stuff I need to do..

Gil.

gilmaimon avatar Dec 17 '19 09:12 gilmaimon

Hey Gil,

thank you for the quick reply. Do you happen to know where to start implementing this feature?

Cheers

schonetech fon: +49 152 3362 0669 fax: +49 321 2144 8745 web: www.schonetech.com e-mail: [email protected]

Am 17.12.2019 um 10:51 schrieb Gil Maimon [email protected]:

Hi, thank you for opening the issue.

There is no support for that currently, no one has ever requested it before so it wasn't on my backlog.

As the library gets more popular I assume more people will come here looking for this feature. I'll add it to the backlog, but it might take a while until I actually get to work on it.

Depending on the public need for this feature, I might prioritize it over other stuff I need to do..

Gil.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

floolean avatar Dec 18 '19 14:12 floolean

Sorry for the delay.

If you want to work on this feature, I recommand lookin at how the library handles secure vs non secure clients. See this for configuration and look here for client and server tcp wrappers.

How I would go about doing this:

  • Create a SecuredEsp32TcpServer and SecuredEsp8266TcpServer, it will be a good idea to create a base class that inherits from TcpServer but adds some secure functions that both esp8266 and esp32 supports. In secure clients for example. the esp8266 and esp32 interface is very simmilar so I created a class that gets the WiFiClient type as template and as such I avoided some code duplication
  • After you have the classes implemented you will want to add them to the configuration so you will have some macro that defines the current secured tcp server type no matter what platform the code is compiling for
  • Then you will want to modify the websockets server code to have secure functions (like set certificates and such) and handle clients appropriatly. This is just one way off the top of my head to implement this. It is open for discussion and contribution.

Thank you, Gil.

gilmaimon avatar Apr 21 '20 10:04 gilmaimon

I'm unfortunately unqualified to get started on this but think it's really important to get it implemented since any PWA would require wss to function. Progressive Web Apps require https when serving them and any subsequent websocket connect is enforced by the browser to be secure. Writing one as we speak and I'm really eager to move forward :-)

frippe75 avatar Aug 23 '20 12:08 frippe75

Exact same use case here. Would love to see support for hosting a WSS server.

kmindspark avatar Apr 24 '21 02:04 kmindspark

+1... Any plans to work on this ?

gb-123-git avatar Dec 12 '21 22:12 gb-123-git

+1 ... It will be very helpful

skgadi avatar Dec 13 '21 20:12 skgadi

Yes @frippe75, and the sensors API (for accessing gyro, accelerometer, etc) also requires https/wss for serving. It would be so great if these features are implemented. Btw Thanks 😊

anotherishi avatar Jan 14 '22 06:01 anotherishi

+1 ... It will be very helpful! very help helpful! I need stream video over wss. My work around for now is to create https nodejs server that support wss server to use it as a bridge. But it would be much better if wss is implemented directly to the esp32

kelvin-jara avatar May 24 '22 13:05 kelvin-jara

  • 1

jsondevers avatar Jun 28 '22 13:06 jsondevers

I'm also +1ing this (this feature would certainly pull me over to this library as opposed to others). Do you accept bribes? ;)

Snipeye avatar Jul 31 '22 02:07 Snipeye

Has this been implemented? or are there any other libraries that have a secure webserver implementation using websockets?

meakashrao avatar Feb 02 '23 06:02 meakashrao