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

Hi,
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: https://github.com/Squidex/squidex/tree/master/backend/extensions/Squidex.Extensions/Actions/Kafka

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: https://github.com/notifo-io/notifo :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): https://github.com/notifo-io/notifo/blob/main/media/Push_WebPlugin.PNG

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)