Skip to content

Help in implementing #1

@juanbautista0

Description

@juanbautista0

Hi, I am trying to implement multithreading in a websocket with the ws protocol, in the readme example you use espress, could a TCP socket server be used?

Ejmplo:

import { WebSocketServer } from "ws";
import { PipelineManager } from "./controllers/PipelineManager";
import NodeMultithreading from 'node-multithreading';

const app = () => {
    const wss = new WebSocketServer({ port: 9501 });
    const logManager = (msg: string) => console.log(msg);
    wss.on("listening", (e: any) => logManager("here you write the log when the service starts"));
    wss.on("connection", (ws) => ws.on("message", (message: any) => PipelineManager.likes(message, ws)));

    return wss;
}


NodeMultithreading(app, { isClusterActive: true, log: true, masterPort: 5000 });

Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions