Skip to content

Pre-upgraded WebSocket transport perpetually connects when AutoUpgrade is true #418

@ladenedge

Description

@ladenedge

In v3, I used the following configuration:

Transport = TransportProtocol.WebSocket,
AutoUpgrade = true,

In v4, this seems to lead to an infinite connect loop:

Image

Tracing through the code, it looks like we try to auto-upgrade regardless of whether the transport is already set to WebSocket:

private async Task HandleOpenedMessage(IMessage message)
{
if (!Options.AutoUpgrade)
{
return;
}
var openedMessage = (OpenedMessage)message;
if (!openedMessage.Upgrades.Contains("websocket"))
{
return;
}
Options.Transport = TransportProtocol.WebSocket;
await UpgradeTransportAsync(openedMessage).ConfigureAwait(false);
}

And for some reason, it never breaks out of trying to auto-upgrade the new connection.

The workaround for this problem is simply turning off AutoUpgrade:

AutoUpgrade = false,

However, it does seem like this is a bug. We should either not attempt to upgrade WebSocket transports, or figure out why it doesn't break out of that connect loop. Or both! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions