Team XSockets.NET

Owin

To host XSockets in OWIN is easy and also let you access the HttpContext and the authenticated user (if any).

Install PM> Install-Package XSockets.Owin.Host

The advantage of using the Owin host is that you can use the same port as Owin runs on for WebSocket communication.

Host only in Owin

If you only want to support websockets you can use the configuration shown below. Do note that this will NOT enablel any other protocols than the Microsoft.WebSockets protocol. So if you want to connect clients other than websockets clients you need to take a look at the next option below.

Register XSockets in Owin IAppBuilder

using XSockets.Owin.Host;

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseXSockets(true);
    }
}

Host in Owin and enable all XSockets protocol modules

To enable XSockets other protocols ans still use Owin you have to use another IAppBuilder extension. All you need to do is this.

using XSockets.Owin.Host;

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseXSockets(new OwinHostConfiguration());
    }
}

By using the OwinHostConfiguration a XSockets server will also be started. This server will pick up all protocols as usual, and you can now communicate between clients using Owin WebSockets as other clients connecting directly to XSockets via another port.

So maybe you have some webclient connected via Owin (and Microsoft.WebSockets) and they will be able to communicate with other clients (such as sensors) that is connected directly to XSockets.

results matching ""

    No results matching ""