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

(#123) Close the connection after receiving 204 responses #127

Closed
wants to merge 1 commit into from

Conversation

tothlac
Copy link

@tothlac tothlac commented Dec 2, 2015

In case of receiving an http answer with answer code 204, shotgun will
return the result from the server, but the connection is automatically
closed after receiving this answer.

Related to #123

In case of receiving an http answer with answer code 204, shotgun will
return the result from the server, but the connection is automatically
closed after receiving this answer.
@jfacorro
Copy link
Contributor

jfacorro commented Dec 2, 2015

@tothlac Thank you for your contribution!

The reconnection that issue #123 refers to, is related to a possible on-going request to an SSE endpoint. I haven't fully thought about the implementation of the reconnection logic but off the top my head I would think that we would need to:

  • Check if we are doing an async request and async_mode is sse.
  • If so handle messages such as DOWN and gun_error as a sign that the client has disconnected.
    • DOWN: the gun process died, we should reconnect at the TCP level.
    • gun_error: I would need to check in more depth gun's code, but it seems this messages just means an error regarding the current stream of data (at the HTTP level), we should do a new request to the same endpoint.

The idea is that the TCP connection that shotgun (through gun) opens with its shotgun:open/[2, 3] function should be reused for subsequent requests, until it is explicitly closed with shotgun:close/1 (or the gun process dies on us). This is why the shotgun connection shouldn't be closed when receiving a 204 response.

Once the reconnection logic is implemented, a 204 response while making a request to an SSE endpoint (while connecting or reconnecting to it) should indicate shotgun to stop trying the reconnection, but not to close the connection to the server.

@tothlac
Copy link
Author

tothlac commented Dec 2, 2015

Thanks for the comments @jfacorro .

I missunderstood how the reconnection should be implemented. I will look into the issue and try to modify the current implementation.

@elbrujohalcon
Copy link
Member

any updates on this, @tothlac ?

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

Successfully merging this pull request may close these issues.

3 participants