简体   繁体   中英

Sails.js - how can I pass a socket connection to a child process

I have a simple sails.js application that handles a fairly high volume of socket connections. I want to hand off (or delegate) the socket connection (req.socket) to a child_process so that it can deal with the details of joining/leaving rooms and broadcasting etc.

Once I have forked a child_process how do I get the req.socket object to it? A simple process.send() won't fly.

This child_process is loading up sails too so it has the equipment it needs - just not the socket itself.

The answer was there in the child_process documentation all along

https://nodejs.org/api/child_process.html#child_process_example_sending_a_socket_object

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM