-
Notifications
You must be signed in to change notification settings - Fork 10.4k
SignalR ConnectionToken/ConnectionAddress feature #13773
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
Conversation
src/SignalR/common/Http.Connections.Common/src/NegotiationResponse.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections.Common/src/NegotiateProtocol.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections.Common/src/NegotiateProtocol.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionManager.cs
Outdated
Show resolved
Hide resolved
src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Negotiate.cs
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionContext.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionManager.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/test/NegotiateProtocolTests.cs
Outdated
Show resolved
Hide resolved
So we an old client connects to a new server, we're just setting the connectionId and connectionToken to the same value. This keeps up from having to handle separate code paths on the server for old and new clients. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a majority of the tests in HttpConnectionDispatcherTests
are using negotiate version 0 still
src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Negotiate.cs
Outdated
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionDispatcher.cs
Outdated
Show resolved
Hide resolved
src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Negotiate.cs
Show resolved
Hide resolved
This comment was made automatically. If there is a problem contact [email protected]. I've triaged the above build. I've created/commented on the following issue(s) |
@@ -75,7 +77,7 @@ public HttpConnectionContext(string id, ILogger logger) | |||
} | |||
|
|||
public HttpConnectionContext(string id, IDuplexPipe transport, IDuplexPipe application, ILogger logger = null) | |||
: this(id, logger) | |||
: this(id, null, logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only used for tests? If so, can we add a comment or something? Maybe make it internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we plan to bring this into 3.1 I don't think we can make it internal, but I agree that it should have been internal to start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal class, make all the changes you want!
var queryStringVersionValue = qsVersion.ToString(); | ||
int.TryParse(queryStringVersionValue, out var clientProtocolVersion); | ||
return _manager.CreateConnection(transportPipeOptions, appPipeOptions, clientProtocolVersion); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit:
|
||
Log.CreatedNewConnection(_logger, id); | ||
var connectionTimer = HttpConnectionsEventSource.Log.ConnectionStart(id); | ||
var connection = new HttpConnectionContext(id, _connectionLogger); | ||
var connection = new HttpConnectionContext(id, connectionKey, _connectionLogger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we stuck with the connectionId
and connectionToken
naming throughout. I'd replaces all usages of connectionKey
, privateId
, etc.. with connectionToken
. I'd even rename id
to connectionId
just to make things super clear.
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionDispatcher.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at this for awhile, I realized I strongly dislike us writing a connectionToken for negotiate version 0. We should just omit it.
It will also conveniently force all our tests to be correct.
|
||
Assert.Equal("0rge0d00-0040-0030-0r00-000q00r00e00", connectionId); | ||
Assert.Equal("http://fakeuri.org/negotiate?negotiateVersion=1", testHttpHandler.ReceivedRequests[0].RequestUri.ToString()); | ||
Assert.Equal("http://fakeuri.org/?negotiateVersion=1&id=0rge0d00-0040-0030-0r00-000q00r00e00", testHttpHandler.ReceivedRequests[1].RequestUri.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, this is ugly. Don't have to do it in this PR, but we might want to remove the version from the query string after negotiate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will file a follow up issue.
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionDispatcher.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections.Common/src/NegotiateProtocol.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionDispatcher.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionDispatcher.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs
Outdated
Show resolved
Hide resolved
This comment was made automatically. If there is a problem contact [email protected]. I've triaged the above build. I've created/commented on the following issue(s) |
Adding the connectionToken connectionAddress split.