Add SignalR notification (Rule)

Hello Sebastian,

I would like to try to add a SignalR (Azure) connection to Squidex.
Mainly to do web notification, via a Rule trigger for example. For the time being, my use case will not need to receive data from the client to pass it to squidex.

I could make a parallel Api that connects to SignalR and use the webhook part of Squidex to do the pushes, but I figure it will be nicer and more useful to everyone to add it directly into Squidex.

First of all, does this addition seem relevant to you?
On the other hand, do you think I should go further as an action plugin or as an infrastructure addition directly?
It is necessary to inject service with configuration (appsettings), that ok in the plugins, but also to add an endpoint in the IApplicationBuilder (Area ?)

Thanks for your feedback

of course you can add that. I don’t see why you need anything else than a rule. It has a lot of advantages, such as retry, logging and configurability (is this even a word?).

I would have a look to the kafka plugin / rule:

It does not make sense for the cloud and therefore it needs to be configured via app settings. But it is actually a good mix of settings and rule parameters. I have built it together with a big enterprise customer and could be a good reference.

If you want you can open a PR for that.

I’m actually making progress on adding an action for rules which is actually exactly what I need.
In fact, I would like to push a new content to my web app in some cases (message, notification)

I’m a full Microsoft developer and my company only offers me azure as cloud hosting. So I naturally turned to SignalR for the notification to my client site in react.

Unfortunately Signalr on Azure can’t work alone… it needs an orchestrator.
So either I propose a 100% cloud mode (serverless) with azure functions (more complicated to reuse, or I add to squidex the ability to respond to SignalR messages, provide the azure url, token etc.).

My current Action

Btw: I also work on this: :wink:

About your action: It looks good, but…

  1. I would use Select box for Command (you have to create an enum for that)
  2. I would also use multiline text boxes for things like user and group.

aaaah Notifo, I looked at it, it looks very cool.
I tested it locally but I couldn’t figure out how to make the two sets interact (plus I have a special case of “end” users not available in squidex and “admin” users who are squidex users) and wanting to use SignalR and not Firebase, I passed. However the email/template part interested me a lot…

I will test for the command enum, thanks a lot, it will be nicer (and less validation), for the moment I try to add a SignalR area for the client negociate and the configuration mutualisation

Notifo has no dependency to Squidex (but there is also no integration yet to be honest).

Notifo uses Firebase for MobilePush only.

It also provides a javascript plugin that can be integrated into any website. It is integrated into a Squidex (angular) but also into a IoT webapp (react):

This plugin uses SignalR and falls back to polling if SignalR is not configured.

Do you have any documentation or anything about the communication between squidex and notifo? (I saw the secrets in the appsettings)?
How to make send an email, a web notification with a content of an event happening on squidex :slight_smile:

Not yet. But I can provide something I guess.

1 Like

I have a small question.
I added a new SignalR area with its startup and service with the config in my extension.
It works fine and I have the right answer for the negociate when I make the url (link and signalR azure token).

In the startup, I’m just after the UseSquidexCors() which normally is in AllowAnyOrigin(), but in my react, on connection, I’m still blocked by CORS policy

Any ideas? :slight_smile:

I am not sure I get it. Perhaps it was a misunderstanding from my side. I though you can push to SignalR without actually adding SignalR. You want your users to be connected to your backend and not to Squidex. If this is not possible it would be much easier to add a simple endpoint to your backend and use the webhook rule.

In fact there are two parts to my problem.
1, push to SignalR Azure with the rules to send messages (that’s ok).
2, Offer a connection point to the client to connect to SignalR and receive messages.

On SignalR Azure, there are 2 possibilities to offer this connection point.
Have a .net code (UseAzureSignalR) that offers the endpoint “/negociate” to respond with the link and access token.
Or switch Azure signalR to serverless and create an Azure Function for that “/negociate” endpoint.

In my current project, I already have a 4-site solution structure running to run my platform and I didn’t want to add another one.
So I was trying to add this endpoint to Squidex.
And by doing this, it offers the squidex user the (quick) possibility to set up SignalR

But can you not just add an endpoint to your project where your end users are connected to?

Hi Sebastian, finally I stopped trying to include a SignalR endpoint in Squidex. I switched to a Serveless Azure mode with a Function.
I’ve finalised the SignalR action, I’ll give you a PR later today. Don’t hesitate to modify if I haven’t followed some of the global project design

Just a question, I must have missed something.
Since I passed the “command” as an enum, I have an error on the model validation… Any ideas?
converting value “SignalR” to type ‘Squidex.Extensions.Actions.SignalR.ActionTypeEnum’. Path ‘actionType’.’

Sounds like expected if SignalR ist not a valid enum value.

I don’t really understand why since the select is generated by the enum…
Can I give you my code so you can have a look? :slight_smile:

Perhaps it is just an old rule?

I have PR my code, so if you can take a look :wink: (JulienM77)