File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/FeatBit.ServerSdk/Transport Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,16 @@ public async Task StartAsync(
9191 private static async Task < WebSocket > DefaultWebSocketFactory ( Uri uri , CancellationToken cancellationToken )
9292 {
9393 var webSocket = new ClientWebSocket ( ) ;
94+
95+ // reference: https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/clients/csharp/Http.Connections.Client/src/Internal/WebSocketsTransport.cs#L98-L105
96+ // Full Framework will throw when trying to set the User-Agent header
97+ // So avoid setting it in netstandard2.0 and only set it in netstandard2.1 and higher
98+ #if ! NETSTANDARD2_0 && ! NETFRAMEWORK
9499 webSocket . Options . SetRequestHeader ( "User-Agent" , HttpConstants . UserAgent ) ;
100+ #else
101+ // Set an alternative user agent header on Full framework
102+ webSocket . Options . SetRequestHeader ( "X-FeatBit-User-Agent" , HttpConstants . UserAgent ) ;
103+ #endif
95104
96105 try
97106 {
You can’t perform that action at this time.
0 commit comments