Skip to content

Commit 4a3610d

Browse files
ben-vossben-voss-coremontrose-a
authored
Add an interface for websocket specific transport methods. (#537)
* Add an interface for websocket specific transport methods. * Update src/GraphQL.Client/GraphQLHttpClient.cs Removed unnecessary interface usage Co-authored-by: Alexander Rose <[email protected]> --------- Co-authored-by: Ben Voss <[email protected]> Co-authored-by: Alexander Rose <[email protected]>
1 parent 06bf968 commit 4a3610d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace GraphQL.Client.Abstractions.Websocket;
2+
3+
public interface IGraphQLWebSocketClient : IGraphQLClient
4+
{
5+
/// <summary>
6+
/// Publishes all exceptions which occur inside the websocket receive stream (i.e. for logging purposes)
7+
/// </summary>
8+
IObservable<Exception> WebSocketReceiveErrors { get; }
9+
10+
/// <summary>
11+
/// Publishes the websocket connection state
12+
/// </summary>
13+
IObservable<GraphQLWebsocketConnectionState> WebsocketConnectionState { get; }
14+
15+
/// <summary>
16+
/// Explicitly opens the websocket connection. Will be closed again on disposing the last subscription.
17+
/// </summary>
18+
Task InitializeWebsocketConnection();
19+
}

src/GraphQL.Client/GraphQLHttpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace GraphQL.Client.Http;
88

9-
public class GraphQLHttpClient : IGraphQLClient, IDisposable
9+
public class GraphQLHttpClient : IGraphQLWebSocketClient, IDisposable
1010
{
1111
private readonly Lazy<GraphQLHttpWebSocket> _lazyHttpWebSocket;
1212
private GraphQLHttpWebSocket GraphQlHttpWebSocket => _lazyHttpWebSocket.Value;

0 commit comments

Comments
 (0)