Skip to content

Commit

Permalink
fix: only use WebTransport when TransportWebTransports is set as clie…
Browse files Browse the repository at this point in the history
…nt option
  • Loading branch information
sruehl committed Jan 8, 2024
1 parent 4a9ea04 commit 6aa9891
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions httpconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package signalr
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -127,7 +126,7 @@ func NewHTTPConnection(ctx context.Context, address string, options ...func(*htt
// Select the best connection
var conn Connection
switch {
case negotiateResponse.hasTransport("WebTransports"):
case httpConn.hasTransport(TransportWebTransports) && negotiateResponse.hasTransport(TransportWebTransports):
var d webtransport.Dialer
_, wtConn, err := d.Dial(ctx, reqURL.String(), req.Header)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions negotiateresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package signalr
type TransportType string

var TransportWebSockets TransportType = "WebSockets"
var TransportWebTransports TransportType = "WebTransports"
var TransportServerSentEvents TransportType = "ServerSentEvents"

type TransferFormatType string
Expand Down

0 comments on commit 6aa9891

Please sign in to comment.