I have an Esp32 that streams video data from a camera to a browser.
I also want to transmit data to the browser, but quicker than ajax, maybe 10 - 20 updates per second.
Can I open 2 websockets on the Esp32?
Websockets are a software construct so in theory yes if programmed to do so but you will probably run into problems when sharing the WiFi bandwidth with additional packets. Video streaming generally doesn't like interruptions!
Only one socket opened, on port 82.
But there was no errors compiling and the chip didnt crash.
So I guess the Esp opened a socket on port 81, then closed that and opened another on port 82.
That tells me its possible to close one socket and open another on a diffrent port in the program cycle, so I might just see if that will work.
Websockets are a software construct, thus in principle, yes if implemented correctly, however you will most likely have issues when sharing WiFi bandwidth with extra packets.
It was easy in the end.
Request a frame, send a frame, and repeat 10 times a second, looking for other comms inbetween.
The comms inbetween doesnt even noticeably affect the video.