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

Triggering :chsk/uidport-close event only 5 seconds after a WebSocket channel is closed #414

Closed
khmelevskii opened this issue Sep 26, 2022 · 6 comments

Comments

@khmelevskii
Copy link

khmelevskii commented Sep 26, 2022

Can I configure this 5 second? For example I'm going to use 1500ms. In case that I will be able to change this value it will influence to something?

@ptaoussanis
Copy link
Member

@khmelevskii Hi Yurii. No, currently this isn't configurable.

Should be easy to make this configurable here, PR welcome. Would suggest this value be separately configurable for WebSockets and Ajax, both defaulting to 5000 msecs: e.g. :msecs-allow-reconnect-before-close-ws, :msecs-allow-reconnect-before-close-ajax.

Just curious - what's your motivation in wanting a shorter timeout here?

@khmelevskii
Copy link
Author

@ptaoussanis great, I will create PR.

About motivation. In my app I have user online/offline status on UI. To show this I'm using :chsk/uidport-open and :chsk/uidport-close events. When :chsk/uidport-close triggered I'm checking connected-uid and if user doen't exist (doesn't have connected other clients)I set status of this user to "offline".

@ptaoussanis
Copy link
Member

When :chsk/uidport-close triggered I'm checking connected-uid and if user doen't exist (doesn't have connected other clients)I set status of this user to "offline".

So that's a typical use case, but what's your motivation for reducing the timeout specifically? Note that there's tradeoffs with a lower timeout - you'll get more false-positive :chsk/uidport-close events with a lower timeout. I.e. could make your online/offline status UI more noisy.

@khmelevskii
Copy link
Author

I think this is totally fine to be more noisy here. For example I can see that status in Slack updates immediately (when user refresh slack page I can see that his status blink).

@ptaoussanis
Copy link
Member

Great, thanks for the confirmation. PR welcome 👍

@ptaoussanis ptaoussanis added this to the v1.18 milestone Feb 23, 2023
@ptaoussanis
Copy link
Member

Closing, this will be included in forthcoming v1.18 👍

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

No branches or pull requests

2 participants