Tuesday, February 28, 2017

WebSocket Support for .NET Core

Full WebSocket support is coming with .NET Standard 2.0, which has now been delayed until Q3. In the meantime, there are still a few options to work with...

If you want to use Microsoft.AspNetCore.WebSockets.Server, I have added a middle ware wrapper that feel a lot more like Fleck:

public void Configure(IApplicationBuilder app)
{
    app.UseWebSockets();
    app.UseWebSocketHandler("test", connection =>
    {
        // Register your listeners here
        connection.OnMessage = m =>
        {
            if (m == "hi")
                connection.SendAsync("bye");
        };
    });
}

Enjoy,
Tom

3 comments:

  1. Pretty section of content. I simply stumbled upon your weblog and in accession capital to say that I
    acquire actually loved account your blog posts.
    Any way I’ll be subscribing in your feeds or even I success you get right of
    entry to constantly rapidly.

    토토
    배트맨토토

    ReplyDelete
  2. 토토
    스포츠중계

    Hello there! Quick question that’s totally off topic. Do you know how to make your site mobile friendly? My website looks weird when viewing from my iphone4. I’m trying to find a template or plugin that might be able to resolve this issue. If you have any recommendations, please share. Thanks!

    ReplyDelete
  3. 토토사이트
    먹튀검증
    this is very important information . thank you very much for this post thank you good luck

    ReplyDelete

Real Time Web Analytics