[Libwebsockets] Default port 80/443

Andy Green andy at warmcat.com
Wed May 5 08:10:12 CEST 2021



On 5/5/21 2:30 AM, Jacky Bek wrote:
> Hi
> I read that the default port for web sockets is either 80 or 443.
> However when I execute libwebsockets, it uses 7681.

The examples explicitly default to use 7681, because they are examples.

If I instead put 80 or 443 in the examples, you have to run them as root 
to listen on those low ports, and you may already be running some other 
server on that machine on 80 or 443 so they conflict.

> Can this be changed programmatically ?

If you just look at the sources for any of the server examples, you can 
see what is going on with that

https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/ws-server/minimal-ws-server/minimal-ws-server.c#n84

-Andy


More information about the Libwebsockets mailing list