mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 02:29:59 +00:00
Remove unnecessary comments
This commit is contained in:
@@ -12,6 +12,14 @@ import { DecodeTransform
|
|||||||
const wss = new WebSocket.Server({ port: 9556 });
|
const wss = new WebSocket.Server({ port: 9556 });
|
||||||
|
|
||||||
wss.on("connection", socket => {
|
wss.on("connection", socket => {
|
||||||
|
// Stream for incoming WebSocket messages
|
||||||
|
const messageStream = new Readable({ objectMode: true });
|
||||||
|
messageStream._read = () => {};
|
||||||
|
|
||||||
|
socket.on("message", (message: string) => {
|
||||||
|
messageStream.push(JSON.parse(message));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Daemon and bridge are the same binary, so spawn a new
|
* Daemon and bridge are the same binary, so spawn a new
|
||||||
@@ -19,32 +27,12 @@ wss.on("connection", socket => {
|
|||||||
*/
|
*/
|
||||||
const bridge = spawn(process.execPath, [ process.argv[1] ]);
|
const bridge = spawn(process.execPath, [ process.argv[1] ]);
|
||||||
|
|
||||||
// Stream for incoming WebSocket messages
|
// socket -> bridge.stdin
|
||||||
const messageStream = new Readable({
|
|
||||||
objectMode: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// tslint:disable-next-line:no-empty
|
|
||||||
messageStream._read = () => {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Incoming JSON messages from the extension over the
|
|
||||||
* WebSocket connection are parsed and re-encoded to be sent
|
|
||||||
* to bridge stdin.
|
|
||||||
*/
|
|
||||||
socket.on("message", (message: string) => {
|
|
||||||
messageStream.push(JSON.parse(message));
|
|
||||||
});
|
|
||||||
|
|
||||||
messageStream
|
messageStream
|
||||||
.pipe(new EncodeTransform())
|
.pipe(new EncodeTransform())
|
||||||
.pipe(bridge.stdin);
|
.pipe(bridge.stdin);
|
||||||
|
|
||||||
/**
|
// bridge.stdout -> socket
|
||||||
* Incoming messages from the bridge are decoded and
|
|
||||||
* stringified and sent to the extension over the WebSocket
|
|
||||||
* connection.
|
|
||||||
*/
|
|
||||||
bridge.stdout
|
bridge.stdout
|
||||||
.pipe(new DecodeTransform())
|
.pipe(new DecodeTransform())
|
||||||
.on("data", data => {
|
.on("data", data => {
|
||||||
|
|||||||
Reference in New Issue
Block a user