resgateio/resgate

Resource response on call request

Closed this issue · 2 comments

Issue

It should be possible to make a call or auth request that results in a resource.

Solution

On a call or auth request, instead of sending a result or an error response, it should be possible to respond with a resource ID:

Example response payload to call request:

{
   "rid": "example.model"
}

Similar to the existing new call requests, the gateway will use the resource ID to fetch the resource using a subsequent get request, which will be the actual value returned to the client.

Notes

  • Deprecates the new request as the same effect can be achieved with this update.
  • Requires a MINOR update to the RES protocol as the new request will be deprecated.
  • Legacy new request behavior will be detected by Resgate when:
    • The call request has the method new
    • The result contains an object with a single property, rid.
  • An error on the subsequent get request would result in the same error for the call request.
  • The resource returned to the client will be considered directly subscribed.

RES client protocol's definition the response to auth and call request leaves no room to include resource information without causing breaking changes in the protocol.

To ensure compatibility between Resgate and client libraries of mismatching version, the feature will rely on version request as described in #136 .

Resolved in #138