allow onLogin CB to be specified
This commit is contained in:
+9
-4
@@ -1,11 +1,16 @@
|
||||
import { createWriteStream } from "node:fs";
|
||||
import http from "node:http";
|
||||
import { RemoteInfo } from "dgram";
|
||||
|
||||
import { Handlers, makeSession, Session } from "./session.js";
|
||||
import { Handlers, makeSession, Session, startVideoStream } from "./session.js";
|
||||
import { discoverDevices } from "./discovery.js";
|
||||
import { DevSerial } from "./impl.js";
|
||||
|
||||
const opts = { debug: false, ansi: false };
|
||||
const opts = {
|
||||
debug: false,
|
||||
ansi: false,
|
||||
discovery_ip: "192.168.40.101", //, "192.168.1.255";
|
||||
};
|
||||
|
||||
let BOUNDARY = "a very good boundary line";
|
||||
let responses = [];
|
||||
@@ -38,13 +43,13 @@ const server = http.createServer((req, res) => {
|
||||
});
|
||||
|
||||
let devEv = discoverDevices(opts);
|
||||
devEv.on("discover", (rinfo, dev: DevSerial) => {
|
||||
devEv.on("discover", (rinfo: RemoteInfo, dev: DevSerial) => {
|
||||
if (dev.devId in sessions) {
|
||||
console.log(`ignoring ${dev.devId} - ${rinfo.address}`);
|
||||
return;
|
||||
}
|
||||
console.log(`discovered ${dev.devId} - ${rinfo.address}`);
|
||||
const s = makeSession(Handlers, dev, rinfo, opts);
|
||||
const s = makeSession(Handlers, dev, rinfo, startVideoStream, opts);
|
||||
const withAudio = false;
|
||||
s.eventEmitter.on("frame", (frame: Buffer) => {
|
||||
let s = `--${BOUNDARY}\r\n`;
|
||||
|
||||
Reference in New Issue
Block a user