Asp.Net 5 Web Hook

 

首先,然我们来看一下WebHooks是什么。WebHooks是一个协议。它们是HTTP回调技术。并且它们是“用户定义的HTTP回调”。你和 (或) 您的应用程序在有什么事情发生时会发送通知,然后您的 URL 端点在那件事情发生的时候就会 收到一封HTTP 邮件。

--来自Scott Hanselman的博客 ASP.NET WebHooks Receivers 介绍-WebHooks 让其变得便捷

同样是通知机制,WebHook跟SingalR的区别在哪里:

SignalR is for notification within an ASP.NET app using WebSockets. You can exchange event notifications through WebSockets, however it requires a constant network connection.

WebHooks are for event notification across other web applications and other external services. (Think B2B communication). For instance, you can receive a WebHook when someone sends you money to your PayPal account. PayPal fires off a POST request to your predefined URL handler and then your app does something with that notification. You pre-configure everything on the PayPal side first. You also set up an application to handle the incoming POST request. The event notification is "pushed" to you in (near) real-time. No need to hold open a network connection while waiting for events.

The two can be complementary. For example, when you receive the WebHook from PayPal, you can notify a logged in user on your webapp (using SignalR/WebSockets) that money has been received successfully.

TLDR: Event notification across different web applications

-- from Difference between ASP.NET WebHooks and Signal-R

做过微信公众号开发的人应该熟悉WebHook的模式吧。微信要求我们为公众号设定一个回调地址,当有用户向公众号发送消息时,这个回调地址所指的服务器回收到来自微信的消息。这不就是一个WebHook的例子吗?

转载于:https://www.cnblogs.com/rader/p/5000385.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值