From 748eadedfe7b84ab0fc2297df0eaac1e3821d00c Mon Sep 17 00:00:00 2001 From: Daniel Mosquera Date: Mon, 28 Sep 2020 09:25:19 -0500 Subject: [PATCH 1/2] Added headers support for web socket connections --- .../GraphQL.Client.Abstractions.Websocket.csproj | 2 ++ .../GraphQLWebSocketRequest.cs | 4 ++-- .../GraphQL.Client.Abstractions.csproj | 1 + .../GraphQL.Client.Serializer.Newtonsoft.csproj | 1 + src/GraphQL.Client/GraphQL.Client.csproj | 8 ++++++++ src/GraphQL.Client/GraphQLHttpClient.cs | 6 ++++++ src/GraphQL.Client/Websocket/GraphQLHttpWebSocket.cs | 2 +- src/GraphQL.Primitives/GraphQL.Primitives.csproj | 1 + 8 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj b/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj index d1980775..38b874ab 100644 --- a/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj +++ b/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj @@ -5,6 +5,8 @@ Abstractions for the Websocket transport used in GraphQL.Client netstandard2.0 + 3.2.0 + 3.2.0.0 diff --git a/src/GraphQL.Client.Abstractions.Websocket/GraphQLWebSocketRequest.cs b/src/GraphQL.Client.Abstractions.Websocket/GraphQLWebSocketRequest.cs index 623e4271..c71b4e28 100644 --- a/src/GraphQL.Client.Abstractions.Websocket/GraphQLWebSocketRequest.cs +++ b/src/GraphQL.Client.Abstractions.Websocket/GraphQLWebSocketRequest.cs @@ -34,9 +34,9 @@ public string Type /// /// The payload of the websocket request /// - public GraphQLRequest Payload + public object Payload { - get => ContainsKey(PAYLOAD_KEY) ? (GraphQLRequest)this[PAYLOAD_KEY] : null; + get => ContainsKey(PAYLOAD_KEY) ? this[PAYLOAD_KEY] : null; set => this[PAYLOAD_KEY] = value; } diff --git a/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj b/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj index 8e1faee1..ed714e5f 100644 --- a/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj +++ b/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj @@ -5,6 +5,7 @@ Abstractions for GraphQL.Client netstandard2.0 + 3.2.0 diff --git a/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj b/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj index 4bbcb784..27042dec 100644 --- a/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj +++ b/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj @@ -5,6 +5,7 @@ A serializer implementation for GraphQL.Client using Newtonsoft.Json as underlying JSON library netstandard2.0 + 3.2.0 diff --git a/src/GraphQL.Client/GraphQL.Client.csproj b/src/GraphQL.Client/GraphQL.Client.csproj index febf2911..2aab092c 100644 --- a/src/GraphQL.Client/GraphQL.Client.csproj +++ b/src/GraphQL.Client/GraphQL.Client.csproj @@ -5,6 +5,14 @@ netstandard2.0;net461 GraphQL.Client.Http + Deinok,Alexander Rose,graphql-dotnet, Cityzenith LLC + Deinok,Alexander Rose,graphql-dotnet, Cityzenith LLC + https://github.com/cityzenith/graphql-client + https://github.com/cityzenith/graphql-client + GraphQL.Client + 3.2.0.0 + 3.2.0.0 + 3.2.0 diff --git a/src/GraphQL.Client/GraphQLHttpClient.cs b/src/GraphQL.Client/GraphQLHttpClient.cs index 21485f01..99233d6b 100644 --- a/src/GraphQL.Client/GraphQLHttpClient.cs +++ b/src/GraphQL.Client/GraphQLHttpClient.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -36,6 +37,11 @@ public class GraphQLHttpClient : IGraphQLClient /// public GraphQLHttpClientOptions Options { get; } + /// + /// The custom web socket headers for initialization of connection + /// + public Dictionary WebSocketHeaders { get; } = new Dictionary(); + /// /// Publishes all exceptions which occur inside the websocket receive stream (i.e. for logging purposes) /// diff --git a/src/GraphQL.Client/Websocket/GraphQLHttpWebSocket.cs b/src/GraphQL.Client/Websocket/GraphQLHttpWebSocket.cs index aba35e8f..5c1ce4a1 100644 --- a/src/GraphQL.Client/Websocket/GraphQLHttpWebSocket.cs +++ b/src/GraphQL.Client/Websocket/GraphQLHttpWebSocket.cs @@ -114,7 +114,7 @@ public IObservable> CreateSubscriptionStream 0 ? _client.WebSocketHeaders : null }; var observable = Observable.Create>(o => diff --git a/src/GraphQL.Primitives/GraphQL.Primitives.csproj b/src/GraphQL.Primitives/GraphQL.Primitives.csproj index 1c324df3..bc20bec2 100644 --- a/src/GraphQL.Primitives/GraphQL.Primitives.csproj +++ b/src/GraphQL.Primitives/GraphQL.Primitives.csproj @@ -6,6 +6,7 @@ GraphQL basic types GraphQL netstandard2.0 + 3.2.0 From f1d030228423e0f5a8ca59b708a14639decd063b Mon Sep 17 00:00:00 2001 From: Daniel Mosquera Date: Mon, 28 Sep 2020 09:29:40 -0500 Subject: [PATCH 2/2] Revert verions --- .../GraphQL.Client.Abstractions.Websocket.csproj | 4 ++-- .../GraphQL.Client.Abstractions.csproj | 2 +- .../GraphQL.Client.Serializer.Newtonsoft.csproj | 2 +- src/GraphQL.Client/GraphQL.Client.csproj | 14 +++++++------- src/GraphQL.Primitives/GraphQL.Primitives.csproj | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj b/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj index 38b874ab..526ff49b 100644 --- a/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj +++ b/src/GraphQL.Client.Abstractions.Websocket/GraphQL.Client.Abstractions.Websocket.csproj @@ -5,8 +5,8 @@ Abstractions for the Websocket transport used in GraphQL.Client netstandard2.0 - 3.2.0 - 3.2.0.0 + 1.0.0 + 1.0.0.0 diff --git a/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj b/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj index ed714e5f..dee0f14c 100644 --- a/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj +++ b/src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj @@ -5,7 +5,7 @@ Abstractions for GraphQL.Client netstandard2.0 - 3.2.0 + 1.0.0 diff --git a/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj b/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj index 27042dec..c7b3ce14 100644 --- a/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj +++ b/src/GraphQL.Client.Serializer.Newtonsoft/GraphQL.Client.Serializer.Newtonsoft.csproj @@ -5,7 +5,7 @@ A serializer implementation for GraphQL.Client using Newtonsoft.Json as underlying JSON library netstandard2.0 - 3.2.0 + 1.0.0 diff --git a/src/GraphQL.Client/GraphQL.Client.csproj b/src/GraphQL.Client/GraphQL.Client.csproj index 2aab092c..db4f4095 100644 --- a/src/GraphQL.Client/GraphQL.Client.csproj +++ b/src/GraphQL.Client/GraphQL.Client.csproj @@ -5,14 +5,14 @@ netstandard2.0;net461 GraphQL.Client.Http - Deinok,Alexander Rose,graphql-dotnet, Cityzenith LLC - Deinok,Alexander Rose,graphql-dotnet, Cityzenith LLC - https://github.com/cityzenith/graphql-client - https://github.com/cityzenith/graphql-client + Deinok,Alexander Rose,graphql-dotnet + Deinok,Alexander Rose,graphql-dotnet + https://github.com/graphql-dotnet/graphql-client + https://github.com/graphql-dotnet/graphql-client GraphQL.Client - 3.2.0.0 - 3.2.0.0 - 3.2.0 + 1.0.0.0 + 1.0.0.0 + 1.0.0 diff --git a/src/GraphQL.Primitives/GraphQL.Primitives.csproj b/src/GraphQL.Primitives/GraphQL.Primitives.csproj index bc20bec2..ab6a7b63 100644 --- a/src/GraphQL.Primitives/GraphQL.Primitives.csproj +++ b/src/GraphQL.Primitives/GraphQL.Primitives.csproj @@ -6,7 +6,7 @@ GraphQL basic types GraphQL netstandard2.0 - 3.2.0 + 1.0.0