1

Is it possible to set up a pubsub via an api? I'm planning on using redis, but I don't want to expose it to the WWW (a security concern). I'd like to have subscribers come in via my Api so I can handle authentication & authorization, but I'm not sure if that's possible? Could I use something like SignalR to have a client subscribe to the bus via the api?

labilbe
  • 3,501
  • 2
  • 29
  • 34
TheDruidsKeeper
  • 325
  • 3
  • 12

1 Answers1

1

You can use ServiceStack Server Events to enable pub/sub real-time notifications over the Internet. It includes an JavaScript client for enabling real-time notifications to Ajax clients as well as a typed .NET Server Events Client for real-time notifications for C#/.NET PCL Clients, including support for Xamarin.Android and Xamarin.iOS clients.

By default it uses an In Memory Server Events implementation but there's also a Redis-server backed Server Events drop-in replacement which will enable subscriptions to the same channel over multiple load-balanced app servers.

The Server Event Examples contains several examples and Live Demos showcasing real-time notifications possible using Server Events.

mythz
  • 141,670
  • 29
  • 246
  • 390
  • 1
    This is exactly what I was hoping for. Thanks for pointing me in the right direction! – TheDruidsKeeper Mar 11 '16 at 05:35
  • Correct me if I'm wrong, but it seems like using Server Events would eliminate the need for any of my processes (worker queues) to directly connect to the redis message bus, and they could just use the Api - would that be wise? I think that it might be useful in reducing the complexity, and saving myself from a possible configuration hell. – TheDruidsKeeper Mar 11 '16 at 05:57
  • @TheDruidsKeeper If you don't have load-balanced app servers you don't need Redis or any kind of message Bus. So if one app server handles all the concurrent connections you need, I'd stick to using the default memory events. – mythz Mar 11 '16 at 06:01
  • The app & web servers will be load balanced, partially for redundancy purposes. I'm looking at having ~ 120 clients connected to a pub/sub system within a facility, then ~ 400 facilities connected to a central hub, doing some pub/sub as well. – TheDruidsKeeper Mar 11 '16 at 06:11