resgateio / resgate

A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.
https://resgate.io
MIT License
685 stars 67 forks source link

Resource response on call request #135

Closed jirenius closed 4 years ago

jirenius commented 4 years ago

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

jirenius commented 4 years ago

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 .

jirenius commented 4 years ago

Resolved in #138