差異處
這裏顯示兩個版本的差異處。
methodology:arch:changedevent [2016/09/29 22:35] tony [Longpoll] |
methodology:arch:changedevent [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== 如何讓Client得知你系統的事件? (工作中) ====== | ||
- | ===== Introduction ===== | ||
- | 不管是任何系統都會有自己特有事件,而使用者會對某些事件有興趣。對於不同的案例,會有不同的解法。這裡主要收集Study的結果。 | ||
- | ===== Categories ===== | ||
- | ==== WebHook - Pub/Sub ==== | ||
- | 在這種方法中,Client扮演著subscriber;Server則為publisher。Client會透過Server提供的介面去註冊某個有興趣的訊息,而Server當發生了事件後,會把訊息送給對應的subscriber。\\ | ||
- | \\ | ||
- | 使用這方法的應用有: [[https://developers.google.com/drive/v3/web/push|Google Drive]]、[[https://azure.microsoft.com/en-us/documentation/articles/app-service-api-dotnet-triggers/|AZure]]、[[https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin|Jenkins Plugin]]。 | ||
- | ==== WebHook – PubSubHubBub ==== | ||
- | 使用這方法的應用有: [[https://wordpress.org/plugins/pubsubhubbub/|WordPress Plugin]]、[[https://developers.google.com/youtube/v3/guides/push_notifications|YouTube]]、[[https://developer.github.com/v3/repos/hooks/|GitHub]]、[[https://www.instagram.com/developer/subscriptions/|Instagram]] | ||
- | ==== Poll ==== | ||
- | 這算是最陽春的方法: 固定一段時間去詢問某個URL的結果,即使它沒有改變。傳統的Web應用程式都是使用這樣的方式,Client-side每幾秒去Server-side要資料。這是一個很沒效率但卻最簡單的做法。以RestAPI而言,User就必須自己去區別資料狀態。\\ | ||
- | \\ | ||
- | 使用這方法的應用有: [[https://www.dropbox.com/developers-v1/core/docs|Dropbox]]、[[https://azure.microsoft.com/en-us/documentation/articles/app-service-api-dotnet-triggers/|AZure]]。 | ||
- | ==== Longpoll ==== | ||
- | Longpoll就是client會先連線至server。在一段時間內,如果server有任何改變就通知client;這段時間如果沒改變,也通知client沒改變。如果一段時間內,有頻繁的通知,client與server就要經歷多次的建立連線、通知、中斷連線循環。因此後來有websocket去解決這樣問題;網路上也有RestAPI+Websocket做法的討論,以後有用到再看看。更多可參考[[https://blog.gtwang.org/web-development/websocket-protocol/|此篇]]\\ | ||
- | \\ | ||
- | 使用這方法的應用有: [[https://www.dropbox.com/developers-v1/core/docs|Dropbox]],。 | ||
- | ==== Hook Scripts ==== | ||
- | 使用這方法的應用有: [[https://git-scm.com/book/zh-tw/v1/Git-%E5%AE%A2%E8%A3%BD%E5%8C%96-Git-Hooks|Git]]、[[http://jdev.tw/blog/340/subversion-hook-scripts|Subversion]]。 | ||
- | ===== Reference ===== | ||
- | * [[http://ivanzuzak.info/2010/01/11/real-time-feed-processing-and-filtering.html|Real-time feed processing and filtering]] | ||
- | * [[https://zh.wikipedia.org/wiki/PubSubHubbub|Wiki - PubSubHubbub]] | ||
- | * [[http://stackoverflow.com/questions/15594905/difference-between-observer-pub-sub-and-data-binding|Difference between Observer, Pub/Sub, and Data Binding]] | ||
- | * [[https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern|Publish–subscribe pattern]] | ||
- | * [[https://blog.gtwang.org/web-development/websocket-protocol/|WebSocket 通訊協定簡介:比較 Polling、Long-Polling 與 Streaming 的運作原理]] | ||
- | |||
- | |||
- | ====== ====== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ |