Demo code for a blog post I wrote: Things I Wish Someone Told Me About ASP.NET Core WebSockets
The demo doesn't look pretty:
But it might help you if you're trying to write a WebSocket handler and you want to compare your code to some running code.
Take a look at MessagePushHandler.cs.
Other files of interest: