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

Add connection session process, event buffer and long-polling support #217

Closed
kevinbader opened this issue May 20, 2019 · 1 comment
Closed
Assignees
Milestone

Comments

@kevinbader
Copy link
Contributor

In order to support apps behind the Azure API Management Gateway with WebSockets disabled, we need to allow apps to "long-poll" for events. This means:

  1. A client connects to RIG via a standard HTTP GET call (similar to SSE but not expecting chunked transfer encoding as a response)
  2. As soon as one or more events are available, RIG sends them (as a list) as the HTTP reply to the client. That closes the HTTP connection.
  3. After receiving the events (or a timeout), the client connects to RIG again, waiting for new events to become available.

In order to support this, we need a "Session" process that buffers incoming events. The ephemeral processes associated to incoming HTTP connections look up the session processes according to the client's JWT:

  • if the client has a JWT, the token's jti identifies the session and with that also the session process. The Erlang process registry should be used to do the lookup, by registering session processes using their associated jti.
  • if the client doesn't own a JWT, there is either no session process or the session process lives exactly as long as the connection process lives.

The session process handles

  • inferring subscriptions from token and passed subscriptions parameter (parsing those values from the request should still be done in the request handlers)
  • subscription refresh towards the filter processes
  • receiving events from filter processes

Also, all session processes should be in a process group to support the new session API - to be implemented in #154 .

Going forward, the SSE and WS handlers should also rely on the session process (using the ring buffer, the SSE handler could even support SSE's "last-event-id" feature to re-send missed events). This is to be implemented in another issue.

jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue May 28, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue May 29, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jun 6, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jun 6, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jun 6, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jul 14, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jul 14, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jul 25, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jul 25, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jul 25, 2019
jakobwgnr added a commit to jakobwgnr/reactive-interaction-gateway that referenced this issue Jul 30, 2019
@kevinbader kevinbader added this to the 2.3.0 milestone Jul 31, 2019
@kevinbader
Copy link
Contributor Author

Closed by #220

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

No branches or pull requests

2 participants