Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

primus-rooms crushes when joining room after re-connect. #68

Open
bfunc opened this issue Feb 13, 2018 · 5 comments
Open

primus-rooms crushes when joining room after re-connect. #68

bfunc opened this issue Feb 13, 2018 · 5 comments

Comments

@bfunc
Copy link

bfunc commented Feb 13, 2018

primus-rooms crushes when joining room after re-connect.

  1. the issue happens is when clients re-connecting (local developent with webpack page reload on code change)
  2. it is happens when more that one client (opened tab) are re-connecting at same time (one tab works well)
      return this._rooms[fn].apply(this._rooms, arguments);
                        ^
TypeError: Cannot read property 'join' of undefined 
                  at Sparky.<anonymous> (...\node_modules\primus-rooms\lib\index.js:171:25)
@kinsi55
Copy link

kinsi55 commented Nov 14, 2018

+1, Have you ever been able to figure out a fix for this?

@bfunc
Copy link
Author

bfunc commented Nov 14, 2018

No, did not saw this in production yet, so left it as is, without further investigation

@kinsi55
Copy link

kinsi55 commented Nov 14, 2018

Weird, had it happen on the first day of using this in production today. I've changed the spark.join() to the primus.join() call now and check if spark._rooms exists beforehand. Also added a try/catch to the join call and just disconnect the spark if an error happens as a workaround for now.

@kinsi55
Copy link

kinsi55 commented Nov 14, 2018

Yep, spark._rooms is indeed pretty often not set in my case. I may just go ahead and build my own system as I only need a single room per client, might be the easiest fix for the while instead of digging trough this code of calls

@kinsi55
Copy link

kinsi55 commented Dec 12, 2018

Thought I'd go ahead and share what I did: I built my own minimal rooms plugin with focus on performance, so if you encounter this issue might be worth to check it out: https://github.com/kinsi55/node_primus-turborooms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants