INNER CODE UNIT · C#

Program

graphql-dotnet/graphql-client · SubscriptionIntegrationTest.ConsoleClient/Program.cs:11

	class Program
	{
		static async Task Main(string[] args)
		{
			Console.WriteLine("configuring client ...");
			using (var client = new GraphQLHttpClient("http://localhost:5000/graphql/", new GraphQLHttpClientOptions{ UseWebSocketForQueriesAndMutations = true }))
			{

				Console.WriteLine("subscribing to message stream ...");

				var subscriptions = new CompositeDisposable();

				subscriptions.Add(client.WebSocketReceiveErrors.Subscribe(e => {
					if(e is WebSocketException we)
						Console.WriteLine($"WebSocketException: {we.Message} (WebSocketError {we.WebSocketErrorCode}, ErrorCode {we.ErrorCode}, NativeErrorCode {we.NativeErrorCode}");
					else
						Console.WriteLine($"Exception in websocket receive stream: {e.ToString()}");
				}));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…