-
Notifications
You must be signed in to change notification settings - Fork 374
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
Properly Shutdown pusher-js client to ensure any pending messages are sent. #669
Comments
Can you clarify where the events originate here? My understanding is that the flow is as follows: Is this correct? |
It's actually node processes, process Client and Process Server using private channel..
|
Thanks, and can you confirm how the ack is sent back to the server? |
I'll spend some time in the console checking to see if the message arrives. I suspect that the process.exit(0) immediately after emitting the message causes it to never be sent, but I'll try and confirm in the console. Edit: I assume that you mean to the "pusher" server, and not the server in the example. I suspect it is never arriving at the pusher server, because otherwise there would be no reason for it to NOT be delivered to our server process waiting for the ACK. |
Sorry for not being clear - I was referring to how this event is sent: |
Here is the server sending the SESSION_COMPLETE and awaiting the SESSION_COMPLETE_ACK.
Where dispatchEvent just calls:
Then in the client we register a handler for the SESSION_COMPLETE message and trigger the ACK..
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you'd like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you. |
Just to update here, this has been raised internally however at this time changes are not being prioritised in the roadmap. |
@benw-pusher Thanks for providing the update. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you'd like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you. |
Preventing closure - this remains outstanding. |
Do you want to request a feature or report a bug?
Feature/Clarification
What is the current behavior?
There is no clear way to shutdown the pusher-js client while waiting for any pending messages to be emitted and delivered to the server. We are using private channels to allow some backend process exchange messages with a web front end. However, when we send our final message indicating sign-off and then exit the node process, often the message is not received by the remote agent, I assume because the node process has exited before the message could be sent.
If the current behavior is a bug, please provide the steps to reproduce and
if possible a minimal demo of the problem via https://jsfiddle.net or similar.
I can try and work on a jsfiddle example and will update the ticket.
What is the expected behavior?
I would expect there be some type of promise which could be awaited to shutdown the pusher-js client to ensure delivery of any pending messages (and prevent queuing of additional messages). Some type of wind down functionality.
Which versions of Pusher, and which browsers / OS are affected by this issue?
Did this work in previous versions of Pusher? If so, which?
7.4.0
The text was updated successfully, but these errors were encountered: