Skip to content

Update SignalR transport protocol spec #13916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 27, 2019

Conversation

mikaelm12
Copy link
Contributor

@mikaelm12 mikaelm12 commented Sep 11, 2019

Blocked on: #13773

@davidfowl
Copy link
Member

We're not merging this change until we merge the feature right?

@mikaelm12
Copy link
Contributor Author

We're not merging this change until we merge the feature right?

Yup

@mikaelm12 mikaelm12 added the blocked The work on this issue is blocked due to some dependency label Sep 12, 2019
@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Sep 12, 2019
Copy link
Contributor

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are references to "Connection ID" lower down that should be updated to refer to Connection Token.

Also, the spec should describe what a server is required to do when an old client arrives. Which is, it must either:

  1. Respond with a single connectionId that is usable as both token and ID, or
  2. Respond with an error payload indicating the older version is not supported by this server.

@BrennanConroy BrennanConroy removed the blocked The work on this issue is blocked due to some dependency label Sep 17, 2019
Copy link
Contributor

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to briefly discuss how we are going to handle versioning this spec. Should we just make this the version 2 spec and use git history? Or should we have sections where we call out version differences in a single "living" spec that covers all versions? I lean towards the latter.

@BrennanConroy
Copy link
Member

Or should we have sections where we call out version differences in a single "living" spec that covers all versions?

I prefer this one. Do we place version headers on each sub-section that has differences and explain the behavior for each version under that header?

Example:

Some section

Version 1.0

Things work

Version 2.0

Things no longer work


* The `connectionToken` which is **required** by the Long Polling and Server-Sent Events transports (in order to correlate sends and receives).
* The `connectionId` which is the id by which other clients can refer to it.
* The `negotiateVersion` which is the negotiation protocol version being used between the server and client.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is odd to me. It's more like a protocolVersion since it's the version of the protocol, not the version of "negotiation".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of us preferred protocolVersion, but shied away from from using that since we thought what what the old client used and we wanted to be able to easily distinguish clients from request logs.

It turns out the old client used clientProtocol as the QS parameter, so I'm also in support of protocolVersion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

```json
{
"connectionId":"807809a5-31bf-470d-9e23-afaee35d8a0d",
"negotiateVersion":0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 0 won't have a version in the response at all, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client could receive this if talking to a new server

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like the negotiateVersion (or whatever it's called) should just not be present in that case. Our clients don't bork if extra properties are present but others might. We can't guarantee that other clients will be compatible, but we can work to avoid breaking them when we can.

Would also be good to put an explicit thing in about clients being required to accept extra JSON properties.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as a general rule, we should require client to ignore unknown properties in payloads and what order the properties arrive in.

While it's possible for the server to use the requested and/or selected negotiateVersion to generate exactly the payload the client expects, I'd rather not go through that extra effort. There also may come a time when we want to add a property to a payload without incrementing and special-casing yet another the protocol version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets decide on this quickly, now that the PR is out for 3.1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know my position, but I certainly won't push back hard if people feel we should omit the negotiateVersion in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as a general rule, we should require client to ignore unknown properties in payloads and what order the properties arrive in.

I do entirely agree with this. It's just a new requirement we're putting on external clients that they may not have been prepared for. Leaving the "version 0" responses untouched protects us from that problem while allowing "version 1 and up" to add the requirement that clients ignore extra fields.

Buuuutt.... I don't care a lot. It should be safe to leave this and patch it out again if a client does come along that requires us to strip this property.

Leave it in. Let's land this ✈.

@BrennanConroy BrennanConroy merged commit 68dcbe3 into master Sep 27, 2019
@ghost ghost deleted the mikaelm12/UpdateTransportSpec branch September 27, 2019 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants