Skip to content

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

Merged
merged 16 commits into from
Sep 16, 2019

Conversation

mikaelm12
Copy link
Contributor

@mikaelm12 mikaelm12 commented Sep 6, 2019

Adding the connectionToken connectionAddress split.

@Eilon Eilon added the area-signalr Includes: SignalR clients and servers label Sep 6, 2019
@mikaelm12 mikaelm12 marked this pull request as ready for review September 10, 2019 00:26
@mikaelm12
Copy link
Contributor Author

@mikaelm12
Copy link
Contributor Author

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.

Copy link
Member

@BrennanConroy BrennanConroy left a 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

@aspnet-hello
Copy link

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)
https://github.com/aspnet/AspNetCore-Internal/issues/2765
https://github.com/aspnet/AspNetCore-Internal/issues/2617
https://github.com/aspnet/AspNetCore-Internal/issues/2730

@@ -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)
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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);

Copy link
Member

Choose a reason for hiding this comment

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

super nit:

Suggested change


Log.CreatedNewConnection(_logger, id);
var connectionTimer = HttpConnectionsEventSource.Log.ConnectionStart(id);
var connection = new HttpConnectionContext(id, _connectionLogger);
var connection = new HttpConnectionContext(id, connectionKey, _connectionLogger);
Copy link
Member

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.

Copy link
Member

@BrennanConroy BrennanConroy left a 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());
Copy link
Member

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

Copy link
Contributor Author

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.

@mikaelm12
Copy link
Contributor Author

@mikaelm12 mikaelm12 merged commit d7e19c4 into master Sep 16, 2019
@mikaelm12 mikaelm12 deleted the mikaelm12/ConnectionAddress branch September 16, 2019 21:22
@aspnet-hello
Copy link

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)
https://github.com/aspnet/AspNetCore-Internal/issues/3130

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.

6 participants