🔌 socket.io support

This commit is contained in:
2021-05-16 23:14:46 -07:00
parent 833c4570e1
commit 86fec59916
3 changed files with 111 additions and 2 deletions

View File

@@ -7,6 +7,24 @@ import hyperquest from "hyperquest";
import es from "event-stream";
import JSONStream from "JSONStream";
import oboe from "oboe";
import { io } from "socket.io-client";
const socket = io("ws://localhost:3853/", {});
socket.on("connect", () => {
console.log(`connect ${socket.id}`);
});
socket.on("disconnect", () => {
console.log(`disconnect`);
});
setInterval(() => {
const start = Date.now();
socket.emit("ping", () => {
console.log(`pong (latency: ${Date.now() - start} ms)`);
});
}, 1000);
router.route("/getComicCovers").post(async (req: Request, res: Response) => {
typeof req.body.extractionOptions === "object"