side WebHook handler?
I am a bit of a newbie in Webhooks, so excuse me if this is a simple question.
I am clear about how Webhook providers work, ie whenever this information needing to be pushed, it sends the payload to the URL specified as callback.
Now my question is: how do I write a client-side Webhook handler, that can detect/process the callback and update my client-side accordingly. For example, if my client-side is a simple web-page with bullet-points, I would like to append new data to the list, whenever it comes through.
Preferably, I would be after a complete JavaScript solution...
Is there perhaps a JS WebHook Client/Handler that already exists? It seems that this should be so common, that it should exist, although I haven't been able to find anything.
Take a look at WebSockets. Depending on your needs, this could be exactly what you need to avoid polling and keep things in sync - particularly if you have a lots of clients who need to see the same updates from your server.
I highly recommend Socket.IO
To consume a webhook API endpoint, or in other words, to "listen for changes", you'd poll for changes, long-poll for changes, or anything else clever you'd like to do.
Or you can use any javascript Publisher Subscriber module to easily do this. try googling around for PubSub stuff. here's an example of one such tool: http://www.pubnub.com/tutorial/javascript-push-api
链接地址: http://www.djcxy.com/p/63548.html上一篇: 使用Rails完全自定义验证错误消息
下一篇: 边WebHook处理程序?