-
Notifications
You must be signed in to change notification settings - Fork 28
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
Using multiple PubNub instances is not possible #91
Comments
@bananafish911 If it possible to change channel names a bit, there is wildcard subscribe feature available. pubnub.subscribe(
to: ["chat.*", "chat-changes.*", "read-receipts.*"],
and: [],
withPresence: true
) With this configuration, client should receive messages, when they published to |
@bananafish911 if more questions about PubNub SDK usage will appear, our support should be able to help ([email protected]) |
Thanks for the answer! Yes, wildcard subscribe will be the next step. Currently we just trying to make it work somehow without massive changes in architecture. JFYI, regarding:
Turns out SubscribeSessionFactory returns same SubscriptionSession despite I try to initialize new instance of pubnub. This is because hash getter is not perfect - it compares properties which may be same across different objects. Changing any of values (eg durationUntilTimeout) listed in hasher solved my problem and it became possible to create different pubnub instances.
|
@bananafish911 I wanted to write about listener and subscription factory, but after figured out that wildcard subscription probably will help, I replaced original response with it. Good to hear that things work for you now! |
This is still an issue. I created two different PubNub instances with the same configuration but both of them get events from each other's channels and if I |
We have a project with literally many chats (8000+), every chat room has following descriptors (chat id itself "chat.id", read receipt descriptor "read-receipts.%chat.id%)", changes descriptor "chat.%chat.id%.changes")
When I try to subscribe to more than 600 chat rooms at once in this way, I got following error in the console:
[Error 2021-11-22T12:00:54.349Z (Subscribe Response Queue#0X2807C6DC0) {Request.finish(error:)#324}] Request 6C151EEC-1C38-4903-82E5-C5192353687E failed with error URI of the request was too long to be processed for response <NSHTTPURLResponse: 0x28138ca00> { URL: https://ps.pndsn.com/v2/subscribe/sub-c-2c6c2b6e-0543-11e8-a831-aa01b54f8d06/read-receipts.5868,read-receipts.4095,read-receipts.5008,read-receipts.5441,chat.4747.changes,chat.5172.changes,read-receipts.4611,chat.4922.changes,read-receipts.5574,chat.5729.changes,chat.6046.changes,read-receipts.4483,read-receipts.4258,read-receipts.4688,chat.4525.changes,read-receipts.4198,chat.5410.changes,chat.4802.changes, ...
To avoid this I tried to use multiple pubnub instances
PubNub(configuration: configuration)
and subscribe every instance to 200 or less chats.But turns out every particular instance becomes subscribed to all channels and it still returns error
"414 URI too long"
.For example: I created PubNub A, and PubNub B instances, subscribe A to channel 1 and b to channel 2, but when I call subscribedChannels() for A, it returns both 1 and 2, and same for B.
And more. When I use unique
SubscriptionListener
for every unique PubNub instance, every listener handles event from all channels that I subscribe from any PubNub instance.The text was updated successfully, but these errors were encountered: