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
689 stars 67 forks source link

Protocol version request #136

Closed jirenius closed 4 years ago

jirenius commented 4 years ago

Issue

The client needs a way to tell Resgate which version of the RES protocol it supports, to ensure a newer version of Resgate doesn't break older clients.

Solution

A new request type should be added:

Version request

method
version

Version requests are sent by the client to tell which RES protocol version it supports, and to get information on what protocol version the gateway supports.

The request SHOULD be the first request sent by the client after an established connection.

If not sent, or if the protocol property is omitted in the request, the gateway should assume the latest protocol version.

Parameters

The request parameters are optional.
It not omitted, the parameters object SHOULD have the following property:

protocol
The RES protocol version supported by the client.
MUST be a string in the format "[MAJOR].[MINOR].[PATCH]". Eg. "1.2.3".

Result

protocol
The RES protocol version supported by the gateway.
MUST be a string in the format "[MAJOR].[MINOR].[PATCH]". Eg. "1.2.3".

Error

A system.unsupportedProtocol error response will be sent if the gateway cannot support the client protocol version.
A system.invalidRequest error response will be sent if the gateway only supports RES Protocol v1.1.1 or below, prior to the introduction of the version request.

Compatibility

jirenius commented 4 years ago

Resolved in #137