mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Handle optional non-localhost endpoint in web signaling server
This commit is contained in:
@ -98,8 +98,10 @@ wsServer.on('request', (req) => {
|
||||
clients[id] = conn;
|
||||
});
|
||||
|
||||
const hostname = '127.0.0.1';
|
||||
const port = 8000;
|
||||
const endpoint = process.env.PORT || '8000';
|
||||
const splitted = endpoint.split(':');
|
||||
const port = splitted.pop();
|
||||
const hostname = splitted.join(':') || '127.0.0.1';
|
||||
|
||||
httpServer.listen(port, hostname, () => {
|
||||
console.log(`Server listening on ${hostname}:${port}`);
|
||||
|
Reference in New Issue
Block a user