SignalR 和 Pusher 的区别 [英] Difference between SignalR and Pusher

查看:59
本文介绍了SignalR 和 Pusher 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 React 作为前端技术创建一个 Web 应用程序.该应用的一项要求是,服务器将能够向所有客户端更新有关更改的信息(不必是准确的实时,但应在不超过 10 秒后更新).

I want to create a web app using React as the front end technology. A requirement for the app is that the server will be able to update all the clients with information about changes (not have to be an exact real time, but should update after no more than 10 seconds).

像客户端每隔几秒向服务器请求更新这样的解决方案是不可能的.

Solutions like clients requesting updates from the server every several seconds are out of the question.

要求:

1) 服务器应使用 .NET 或 Node.js 实现.

1) The server's should be implemented with either .NET or with Node.js.

2) 连接必须通过 IIS 的 443 端口进行保护.

2) The connection MUST be secured via port 443 of the IIS.

我阅读了一些关于 Micorsoft 的 SignalRPusher Channels 的内容,它们似乎提供了我所需要的那种服务.

I read a bit about Micorsoft's SignalR and about Pusher Channels which seems to provide exactly the kind of service I require.

您能否详细说明它们之间到底有什么区别?我应该什么时候选择每个?他们中谁得到了更多的社区支持?哪个更容易实现?诸如此类……

Could you please elaborate about what exactly are the differences between them? When should I choose each? Which of them got more community support? Which is easier to implement? Stuff like that...

推荐答案

SignalR 和 Pusher Channel 最终都使用 websockets 向客户端传递消息,因此两者都应满足您向客户端实时传递消息的要求.

Both SignalR and Pusher Channels ultimately both use websockets to deliver messages to clients, so both should meet your requirements to deliver messages to clients in realtime.

1) 两种产品也满足您对两种库支持的要求:

1) Both offerings also meet your requirements for both library support:

SignalR 支持 .NET:

SignalR supports .NET:

https://dotnet.microsoft.com/apps/aspnet/signalr

Pusher Channels 对 nodejs 和 .NET 都有服务器支持:

Pusher Channels has server support for both nodejs and .NET:

https://github.com/pusher/pusher-http-node

https://github.com/pusher/pusher-http-dotnet

2) 这两种产品也满足您通过 TLS/WSS 发送消息的要求:

2) Both offerings also meet your requirements for sending messages over TLS/WSS:

信号R:

https://kimsereyblog.blogspot.com/2018/07/signalr-with-asp-net-core.html

推送渠道:

保护推送者的消息

就它们之间的差异而言,这取决于您的实现,如果您只是在自己的 ISS 服务器上运行 SignalR,那么您将需要管理所有 websocket 连接以及随之而来的所有扩展挑战.

In terms of the differences between them this depends on your implementation, if you just run SignalR on your own ISS server then it will be down to you to manage all of the websocket connections and all of the scaling challenges that come with this.

不过与 Channels 的工作方式类似,SignalR 也有一个托管的 websocket 服务,因此您不需要管理连接或缩放.您只需使用要发送到 Channels 或 SignalR 的消息发出 API 请求,然后将此消息广播到由 websockets 连接的感兴趣的客户端.在这种情况下,您不需要自己管理 websocket 连接.

However similar to how Channels works, SignalR also has a managed websocket service, so you do not need to manage the connections or scaling. You just make an API request with the message you want to send to either Channels or SignalR and this message is then broadcast to the interested clients connected by websockets. In this scenario you do not manage the websocket connections yourself.

然而,就定价而言,渠道似乎更具竞争力(尤其是免费产品),因此,如果您正在查看托管产品,渠道似乎是一个更好的价值主张:

However in terms of pricing Channels appears to be far more competitive (especially the free offering), so if you are looking at the managed offering Channels looks to be a better value proposition:

https://azure.microsoft.com/en-gb/pricing/details/signalr-service/

https://pusher.com/channels/pricing

两种产品在实现方面看起来非常相似(假设您使用的是托管服务).如果您在 ISS 上实施 SignalR,复杂性会增加:

Both offerings look fairly similar in terms of implementation (assuming you are using the managed service). The complexity would increase if you implement SignalR on ISS:

https://docs.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-2.2

在支持方面,Pusher 提供免费的应用程序支持服务:

In terms of support Pusher has a free application support offering:

https://support.pusher.com/hc/en-us

希望这会有所帮助!

这篇关于SignalR 和 Pusher 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆