[英]How can I send a SignalR message from an Azure Function without using Azure SignalR Service
I have an older C# app that is being migrated to the cloud.我有一个旧的 C# 应用程序正在迁移到云中。 It uses SignalR, but only direct client/server connections.它使用 SignalR,但仅直接客户端/服务器连接。 No SignalR service is involved yet.目前还没有涉及SignalR业务。
I am extracting some processes that are well suited for an Azure function, but one feature I would prefer to not have to redesign for this MVP is a SignalR message back to the user that tells them the percent complete for this job.我正在提取一些非常适合 Azure function 的流程,但我希望不必为此 MVP 重新设计的一个功能是向用户返回一条 SignalR 消息,告诉他们这项工作的完成百分比。
I am reading the MS documentation from here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service-output?tabs=in-process&pivots=programming-language-csharp focusing on Isolated-Processes.我正在从这里阅读 MS 文档: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service-output?tabs=in-process&pivots=programming-language-csharp专注于隔离进程。
I can see how I can send messages to the Azure SignalR service, but I am unclear how I might be able to just send a message back to the caller.我可以看到如何将消息发送到 Azure SignalR 服务,但我不清楚如何才能将消息发送回呼叫者。
I would really like to set up a simple Hub and send messages directly to the client as the function progresses.我真的很想设置一个简单的集线器,并在 function 进行时直接向客户端发送消息。
I would suggest giving web pub sub a look?我建议给 web pub sub 看看? Microsoft has a good comparison article here .微软在这里有一篇很好的比较文章。 Summary, it is a bit more language agnostic, and if you're already using azure then it has less setup overhead than SignalR.总而言之,它与语言无关,如果您已经在使用 azure,那么它的设置开销比 SignalR 少。
https://dev.to/albertbe.nett/how-to-azure-pubsub-service-2ccb https://dev.to/albertbe.nett/how-to-azure-pubsub-service-2ccb
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.