mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 09:39:58 +00:00
Add options to switch bridge backup WebSocket server port
This commit is contained in:
@@ -3,13 +3,27 @@
|
||||
import { spawn } from "child_process";
|
||||
import { Readable } from "stream";
|
||||
|
||||
import minimist from "minimist";
|
||||
import WebSocket from "ws";
|
||||
|
||||
import { DecodeTransform
|
||||
, EncodeTransform } from "../transforms";
|
||||
|
||||
|
||||
const wss = new WebSocket.Server({ port: 9556 });
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: [ "port" ]
|
||||
, default: {
|
||||
port: "9556"
|
||||
}
|
||||
});
|
||||
|
||||
const port = parseInt(argv.port);
|
||||
if (!port || port < 1025 || port > 65535) {
|
||||
console.error("Invalid port specified!");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const wss = new WebSocket.Server({ port });
|
||||
|
||||
wss.on("connection", socket => {
|
||||
// Stream for incoming WebSocket messages
|
||||
|
||||
Reference in New Issue
Block a user