heroku多个dyno socket.io [英] heroku multiple dyno socket.io

查看:108
本文介绍了heroku多个dyno socket.io的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Socket.io开发一个node.js应用程序,并在Heroku Dyno上部署它。 Socket.io使用RedisStore及其PUB / SUB。 Socket.io客户端与her​​oku中的一个dyno完美兼容。但是,当我增加一个以上的dyno(比如两个)时,socket io客户端请求不起作用。



请让我知道客户端上的任何特定配置side)是需要的,同时设置heroku以支持socket.io的多个web dyno。 解决方案

抱歉,但是heroku不支持粘性会话并且它不被Socket.io支持


粘滞负载均衡如果您打算将
连接的负载分配给不同的进程或机器,您必须确保
与特定会话ID相关联的请求连接到源自它们的进程的


使用多个节点


I am developing a node.js application with Socket.io and deploying same on Heroku Dyno. Socket.io is using RedisStore with its PUB/SUB. Socket.io client works perfectly fine with one dyno in heroku. But when I increase the number of dyno to more than one (say two), socket io client request does not work.

Please let me know if any specific configuration on client side is needed while setting up heroku for multiple web dyno having socket.io support.

解决方案

Sorry, but heroku doesn't support sticky session and it's not supported by Socket.io

Sticky load balancing If you plan to distribute the load of connections among different processes or machines, you have to make sure that requests associated with a particular session id connect to the process that originated them.

Using multiple nodes

这篇关于heroku多个dyno socket.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆