-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
server push silently fails for reconnected clients #127
Comments
Hi Colin, A little busy atm so can't look into this in detail right now, but didn't want to leave you hanging - so some quick thoughts:
This is expected. Sente's API defines async push to an invalid or disconnected client uid as a noop. Uids are expected to come and go (sometimes temporarily while they experience connection difficulties, etc.).
This could be caused by your user-id somehow being inconsistent pre/post reconnect...
I'd start by looking here. Are you specifying a persistent See here for a detailed explanation of how the client+user ids work. They're inherently a little tricky due to the way browsers work, but not too bad once you understand what's actually going on. It sounds to me like you might want So, literally, can you think of any data available to a client that:
If you can, then that might make a good client-id. If not, then you may need a different strategy. To be clear: these requirements aren't requirements of Sente, they're intrinsic requirements of identity. Does any of that help? |
I should have added that something like (defonce random-client-uuid (encore/uuid-str)) ; Define on first js load
{:user-id random-client-uuid} ; Plug into chsk constructor May do the trick for the specific case of persistence that needs to only live as long as a particular page refresh. |
Closing this for now, please feel free to re-open if you're still having any issues. |
No problem - I meant to respond earlier but got side tracked elsewhere. Thanks for your suggestions! |
Hi, this is almost certainly something I am doing/not understanding, so assume the bug is in my head. However, I can't see where it is, hence this ;).
I don't need to 'preserve' user state across disconnects or sessions etc., so I have a new UUID created for each 'client':
(sente/make-channel-socket!
taoensso.sente.server-adapters.http-kit/http-kit-adapter
{:user-id-fn :client-id})
However, each 'client' does register a bunch of server side state (which materialised views it wants for example), but for simplicity I want to treat disconnects/reconnects as a new connection:
However, I am noticing the following behaviour:
To be clear, the server periodically pushes data to the client when it notices one of the views that the client is interested in has changed. Imagine the server time is such a view. Also, I am not explicitly removing disconnected clients so I will be calling closed over send-fn's for clients that are no longer connected.
I see neither an error when sente tries to push to the old disconnected client or any warnings when it tries to push to the new client.
As I say, I am sure it is my misunderstanding but I don't understand:
Any hints?
Thanks!
The text was updated successfully, but these errors were encountered: