diff options
author | Florrie <towerofnix@gmail.com> | 2020-07-10 20:52:13 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2020-07-10 20:52:13 -0300 |
commit | d00b26b23d9b3fc1e54a4d117366f0f22e664135 (patch) | |
tree | 7bc214a0ca10eec5ea6ae5d641481409aa00cc6d /index.js | |
parent | 503a37ba4d7550f9c2ed1602e589a0142a20d10d (diff) |
basic command relay across socket clients
Diffstat (limited to 'index.js')
-rwxr-xr-x | index.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/index.js b/index.js index b0db6cd..03b5bb1 100755 --- a/index.js +++ b/index.js @@ -75,7 +75,7 @@ async function main() { 'player-options': {type: 'series'}, 'stress-test': {type: 'flag'}, 'socket-client': {type: 'value'}, - 'socket-server': {type: 'flag'}, + 'socket-server': {type: 'value'}, 'telnet-server': {type: 'flag'}, [parseOptions.handleDashless](option) { playlistSources.push(option) @@ -147,20 +147,26 @@ async function main() { appElement.attachAsServerHost(telnetServer) } + let socketClient let socketServer if (options['socket-server']) { socketServer = makeSocketServer() attachSocketServerToBackend(socketServer, backend) - socketServer.listen(1255) + socketServer.listen(options['socket-server']) + + socketClient = makeSocketClient() + socketClient.socket.connect(options['socket-server']) } - let socketClient if (options['socket-client']) { socketClient = makeSocketClient() + socketClient.socket.connect(options['socket-client']) + } + + if (socketClient) { attachBackendToSocketClient(backend, socketClient, { getPlaylistSources: () => appElement.playlistSources }) - socketClient.socket.connect(1255) } if (options['stress-test']) { |