1

I'm new to Windows development, coming from macOS and iOS development.

I've to work with System.Net.WebSockets.ClientWebSocket to implement some sort of private push notification service.

I other languages I'm used to closure / blocks / functional programming to handle events like a WebSocket message.

Reading at System.Net.WebSockets.ClientWebSocket documentation, it seems really old school with read method that I have to call all the time.

Did I understood well?

How should I use System.Net.WebSockets.ClientWebSocket to handle messages in background as event and once they are here, call a specific block of code to handle them?

The goal is really to transform incoming message in events and then, handle those events in another part of the code.

ygini
  • 105
  • 1
  • 7
  • Have a look at [this answer](https://stackoverflow.com/a/35896157). Do note that Sockets/WebSockets are low-level APIs. There are higher level APIs where you don't have to implement so many of the communication details yourself such as [Web API 2](https://codeopinion.com/self-host-asp-net-web-api-as-a-windows-service/) and [WCF](https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service). – NightOwl888 Jan 21 '18 at 14:04

0 Answers0