Skip to content

Support for invocations based on websocket messages #325

@mhamann

Description

@mhamann

Provide a mechanism by which API invocations (e.g. to a Whisk action) may be triggered by a message to a websocket.

The basic approach could be something like:

  • Client attempts to make a websocket connection to the API gateway on a path (e.g. /tenant/basepath/api)
  • Gateway enforces pre-request policies (e.g. client id/secret, oauth, rate limit, etc).
  • Assuming pre-request checks succeed, gateway allows a websocket upgrade and accepts the connection
  • When the client sends a message, the gateway will invoke the target endpoint defined in the API doc, passing the message in the request body. If security policies were run as part of the initial connection, then any API key or user identity information would be included in the headers to the backend endpoint.
  • Once the backend request is complete, the gateway will pass any response body to the client via a websocket message.

There may also be a case where the API developer may wish the gateway to proxy the entire websocket connection through to the backend. This could be detected via the proxy policy having a ws:// or wss:// protocol in the target URL. Some work would still need to be done there to define how that works, but that would enable push messages from a backend. This is a more advanced use-case that probably needs addition design.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions