Is the any means to alter the port number?
karelv opened this issue · 2 comments
I think the default port is 80 for this websocket server.
But can this be a configuration item?
Thanks!
This does not actually handle the port opening at all, that will be done in your application. This can be shown in the example project I wrote. These lines handle the opening of the port, which is used for websockets and web pages:
https://github.com/Molorius/ESP32-Examples/blob/b4b6984ddcb44aa800d247ee382cbb9886198eaa/websocket_server/main/main.c#L352-L353
The connection handle is eventually passed to ws_server_add_client:
https://github.com/Molorius/ESP32-Examples/blob/b4b6984ddcb44aa800d247ee382cbb9886198eaa/websocket_server/main/main.c#L283
Does that make sense how the connection is moved? So to change the port, you just need to add a new listener on your desired port and move any websocket upgrades with ws_server_add_client.
Thanks for pointing out this for me!