Reconnecting in Socket.io and maintaining client id?

Is this possible? I can’t find any documentation on the subject but from the tests I’ve done so far, a new client id is assigned every time a client reconnects. If its not possible what would be the best workaround? Thanks!

Problem courtesy of: uguMark

Solution

At the moment I don’t think it’s possible (I’ve asked the same question myself to `3rd-Eden, Socket.IO core dev).

However you can setup some unique key yourself on the client’s session, that’s the best workaround at the moment and usually people find this ok (for example put the username on the session or another unique id).

Solution courtesy of: alessioalex

Node.js Recipes责编内容来自:Node.js Recipes (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Reconnecting in Socket.io and maintaining client id?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录