docs: socket.io-auth.js #2340
Closed
jingmingji wants to merge 12 commits into
Closed
Conversation
1、socket.join(room)放到了nsp.adapter.clients()里面有问题,导致clients返回到前端无法正常携带当前的socket信息,应该把socket.join(room)放到nsp.adapter.clients()外面先执行,亲测如此可以正常返回clients数据。 2、另外clients[id] = query,这个操作和插件本身的操作有冲突,因为socket.join(room)调用成功后,会自动将socketid放入到clients数组里面。如果想添加多余的信息可以通过其他字段来返回,没必要对这个插件会调用的属性进行操作。
Codecov Report
@@ Coverage Diff @@
## master #2340 +/- ##
=======================================
Coverage 99.61% 99.61%
=======================================
Files 29 29
Lines 773 773
=======================================
Hits 770 770
Misses 3 3Continue to review full report at Codecov.
|
Member
Member
|
#2354 更新过了,这边关了,辛苦了 |
|
@thonatos uws的npm包是deprecated的,稳定性怎么样 |
Member
|
很久没用了,不大确定,之前用它是因为在 ff 上兼容性有问题。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
官方文档socket.io实例—p2p聊天,中间件auth.js里面
socket.join(room)放到了nsp.adapter.clients()里面有问题,导致clients返回到前端无法正常携带当前的socket信息,应该把socket.join(room)放到nsp.adapter.clients()外面先执行,亲测如此可以正常返回clients数据。另外clients[id] = query这个操作和插件本身的操作有冲突,因为socket.join(room)调用成功后,会自动将socketid放入到clients数组里面。如果想添加多余的信息可以通过其他字段来返回,没必要对这个插件会调用的属性进行操作。