PubNub unsubscribe slows down the whole web application
Asked Answered
C

1

7

I noticed my JS app gets slow sometimes (all UI gets slow). I tried to figure out why and I noticed that PUBNUB unsubscribe event is really heavy. All other PUBNUB events, such as state, subscribe work well.

It should be async, I know, but even being async it slows down the whole app, even when it's very simple.

I use pubnub presence.

Chrome Profile

Do you know is that happening? Is that a pubnub bug? And how to improve it's performance.

Crumbly answered 3/4, 2015 at 21:26 Comment(2)
Hi Michael, I've posted your answer below which will help guide you in deciding upon the option to utilize the noleave flag.Sartin
You can enable implicit goodbye events on your account by contacting [email protected] and ask for the TCP_FIN processing feature to be enabled on your account. This will place the event leave processing on the PubNub Network Servers vs your Client. This allows you to disable explicit leave events by setting the noleave flag true. By performing these steps your page speed to your normal level of performance.Sartin
P
0

[UPDATE: Self-serve property configuration is possible] You can enable the "generate leave on disconnect" property for your PubNub Key Set

  1. login to your PN account
  2. select your key set (sub/pub keys)
  3. under PRESENCE, Generate Leave on TCP Fin or RST property can be enabled or disabled

PRESENCE gen leave config

Enabled means that when the client drops the connection, PN server will interpret the TCP FIN (or RST) signal as a leave event.

Disabled means no leave presence event is generated and eventually a timeout presence event will be generated for that client (UUID) for each channel they were previously subscribed to

An explicit unsubscribe call by the client always results in leave presence events being generated for each of the channels that was in that call.

NOTE: Be sure to test your app thoroughly when you change this property. It would seem to be having this property enabled is always the best option but it may have unexpected behaviors depending on your implementation.

See docs for more details about how PubNub Presence works

For any questions, please contact [email protected] with details to get further insights.

Photobathic answered 3/4, 2015 at 21:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.