SignalR Hubs in a class library? Is this a good idea or a bad one?

I am new to SignalR. I started writing a hub and put this logic in a class library.

Here I am trying to execute:

I have a "preprocessor" service that shuts down and pre-displays several objects / documents / etc from external sources and puts them in the cache. I use a hub to communicate with customers when all the elements are pre-programmed.

We also have several customer clients. Among them:

  • typical MVC application / project
  • console application we use for quick testing
  • webapi and the WCF / SOAP project for providing our services to external parties.
  • a unit test project

Problem

By placing the hub in the class library, I made all downstream consumers (including other class libraries) have an OWIN dependency ... and now I need my launch class (and application settings) to tell Owin not to use it).

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

or

<add key="owin:AutomaticAppStartup " value="false" />

Architecture?

It "smells" to me. Maybe SignalR hubs are not intended for a class library? If so, what will be the best design? for example, have a hub in your own WebApi service? And a proxy for this service? So my preprocessor logic (contained in the class library) can call a hub?

Suggestions would be greatly appreciated.

+4
source share
1 answer

SignalR , , , , , . SignalR , - , . . , SignalR , , Owin .

+4

Source: https://habr.com/ru/post/1542958/


All Articles