File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
GraphQL.Client.Abstractions.Websocket Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ public string Type
3434 /// <summary>
3535 /// The payload of the websocket request
3636 /// </summary>
37- public GraphQLRequest Payload
37+ public object Payload
3838 {
39- get => ContainsKey ( PAYLOAD_KEY ) ? ( GraphQLRequest ) this [ PAYLOAD_KEY ] : null ;
39+ get => ContainsKey ( PAYLOAD_KEY ) ? this [ PAYLOAD_KEY ] : null ;
4040 set => this [ PAYLOAD_KEY ] = value ;
4141 }
4242
Original file line number Diff line number Diff line change @@ -56,5 +56,11 @@ public class GraphQLHttpClientOptions
5656 /// Configure additional websocket options (i.e. headers). This will not be invoked on Windows 7 when targeting .NET Framework 4.x.
5757 /// </summary>
5858 public Action < ClientWebSocketOptions > ConfigureWebsocketOptions { get ; set ; } = options => { } ;
59+
60+ /// <summary>
61+ /// The `ConnectionParams` object sent with the GQL_CONNECTION_INIT message on establishing a websocket connection.
62+ /// See https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md#gql_connection_init.
63+ /// </summary>
64+ public object ? WebSocketConnectionParams { get ; set ; } = null ;
5965 }
6066}
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ public IObservable<GraphQLResponse<TResponse>> CreateSubscriptionStream<TRespons
105105 Type = GraphQLWebSocketMessageType . GQL_START ,
106106 Payload = request
107107 } ;
108- var closeRequest = new GraphQLWebSocketRequest
108+ var stopRequest = new GraphQLWebSocketRequest
109109 {
110110 Id = startRequest . Id ,
111111 Type = GraphQLWebSocketMessageType . GQL_STOP
@@ -114,7 +114,7 @@ public IObservable<GraphQLResponse<TResponse>> CreateSubscriptionStream<TRespons
114114 {
115115 Id = startRequest . Id ,
116116 Type = GraphQLWebSocketMessageType . GQL_CONNECTION_INIT ,
117- Payload = new GraphQLRequest ( )
117+ Payload = Options . WebSocketConnectionParams
118118 } ;
119119
120120 var observable = Observable . Create < GraphQLResponse < TResponse > > ( o =>
@@ -179,8 +179,8 @@ public IObservable<GraphQLResponse<TResponse>> CreateSubscriptionStream<TRespons
179179
180180 try
181181 {
182- Debug . WriteLine ( $ "sending close message on subscription { startRequest . Id } ") ;
183- await QueueWebSocketRequest ( closeRequest ) ;
182+ Debug . WriteLine ( $ "sending stop message on subscription { startRequest . Id } ") ;
183+ await QueueWebSocketRequest ( stopRequest ) ;
184184 }
185185 // do not break on disposing
186186 catch ( OperationCanceledException ) { }
You can’t perform that action at this time.
0 commit comments