🚥 Socket.io integration WIP
This commit is contained in:
@@ -1,43 +1,14 @@
|
||||
import router from "../router";
|
||||
import { Request, Response } from "express";
|
||||
import axios from "axios";
|
||||
import stream from "stream";
|
||||
import through2 from "through2";
|
||||
import hyperquest from "hyperquest";
|
||||
import request from "request";
|
||||
import es from "event-stream";
|
||||
import JSONStream from "JSONStream";
|
||||
import oboe from "oboe";
|
||||
import { io } from "socket.io-client";
|
||||
|
||||
const socket = io("ws://localhost:3000/", {
|
||||
reconnectionDelayMax: 10000,
|
||||
});
|
||||
|
||||
socket.on("connect", () => {
|
||||
console.log(`connect ${socket.id}`);
|
||||
});
|
||||
|
||||
socket.on("disconnect", () => {
|
||||
console.log(`disconnect`);
|
||||
});
|
||||
|
||||
router.route("/getComicCovers").post(async (req: Request, res: Response) => {
|
||||
typeof req.body.extractionOptions === "object"
|
||||
? req.body.extractionOptions
|
||||
: {};
|
||||
const { extractionOptions, walkedFolders } = req.body;
|
||||
socket.emit("call", {
|
||||
action: "getComicCovers",
|
||||
params: {
|
||||
extractionOptions,
|
||||
walkedFolders,
|
||||
},
|
||||
opts: { garam: "pasha" },
|
||||
});
|
||||
socket.on("comicBookCoverMetadata", (done) => {
|
||||
console.log(done);
|
||||
});
|
||||
|
||||
// res.sendStatus(200);
|
||||
// socket.on("hello", (done) => done);
|
||||
res.sendStatus(200);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user