resgateio/resgate

Protocol version request

Closed this issue · 1 comments

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

  • The RES Protocol will require a PATCH version update as the change will be backward compatible.
  • Current Resgate version will correctly reply with a system.invalidRequest on the request.
  • A client receiving a system.invalidRequest can act according to RES protocol v1.1.1 .

Resolved in #137