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

When site_id_lookup returns sth else than string messages are not dispatched to long polling clients #206

Open
pawelniewie opened this issue May 29, 2019 · 1 comment

Comments

@pawelniewie
Copy link

Noticed that if site_id_lookup returns an Integer instead of the string you will think everything works but messages will be retrieved only on the start of the request (after the client establishes the connection). Publishing new message will not transfer them in long polling chunked mode.

To explain better, once a client connects client.backlog is called to get all existing messages, that calls @bus.backlog which encodes site_id into a string and there's no issue there. Works as expected.

But later MessageBus::ConnectionManager is used to push out new messages, it uses @subscriptions[msg.site_id] to look up any clients (which is string even if the message was published with site_id set to an integer) but add_client uses client.site_id established by site_id_lookup which if it returns anything else than a string will break lookup in connection_manager.rb:25

Leaving for anyone scratching their heads.

Generally would be great to either assert returned type from site_id_lookup or convert it to a string in connection_manager.rb

That was my fault but would be great if API helped diagnose problems like that.

@SamSaffron
Copy link
Member

Yeah I totally support something like

site_id = site_id.to_s if site_id != nil

care to make a PR and maybe add a test for it?

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

No branches or pull requests

2 participants