简体   繁体   中英

Node.js - How to share sessions between http server and net server?

I'm trying to make server that helps http clients and net clients to connect between them, but I'm not sure that whether some module such as redis can help the server to share sessions or make connections from http to net.

Because I wanna use cluste r (because of load balancing) to optimize speed in multi-core processors, I think the sessions must be shared.

Here is the server what I make

在此处输入图片说明

Using Redis is a good approach to save and share session details when using clusters. Read more on this approach here Nodejs Clustering and expressjs sessions .

Another approach would be to use Express Session module if your web application is developed using ExpressJS. This link https://medium.com/@karaxuna/how-to-share-session-across-mutiple-nodejs-http-server-instances-7d466389d123#.wrg84qel6 provides on how to configure Express Session module.

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