Faye,Simple pub/sub messaging for the web

來源:互聯網
上載者:User

標籤:網路   node.js   pubsub   

參考資料

http://faye.jcoglan.com/

  

  

Faye is a publish-subscribe messaging system based on theBayeux protocol/CometD. It provides message servers forNode.js and Ruby, and clients for use on the server and in all major web browsers.

  

  

系統架構

  

  

組件

功能

Storage

儲存內容

  • 活躍client的id
  • 訂閱資訊
  • queued message to be delivered to clients

儲存方式

  • memory engine
  • redis engine

Engine

Storage的抽象層,實現了Faye的所有服務

  • client registering
  • storing subscriptions
  • routing messages

Server

實現了Bayeus 協議,操作集

  • handshake
  • connect
  • disconnect
  • subscribe
  • unsubscribe
  • publish

Server無HTTP或其他任何網路傳輸技術有關

Server-side extendsions

擴充層,可以攔截incoming/outgoing message

Adapter

通過HTTP提供Server的服務,負責以JSON方式序列化和還原序列化message;

串連處理

  • 基於WebSocket的持久串連
  • 基於HTTP POST的long polling
  • CORS(Cross Origin Resource sharing)
  • JSONP

兩個實現:NodeAdapter, RackAdapter

Transport

用戶端的network transport,負責通訊和JSON的序列化和還原序列化以及網路故障的檢測和恢複

  • Websocket即時性強
  • long polling / JSONP只能依賴逾時

client-side extensions

類似於Server-side extendsions

client

提供subscribe/unsubscribe, send/receive message的介面,實現了Bayeux protocol,使用者不需要處理handshake 和 connect等底層操作

  

  

Cluster支援

這種結構中的Storage採用Redis。Server是無狀態,方便水平擴充,簡化路由(使用隨機/rr策略即可)。

  

  

使用簡單

  

使用類似socket.io。

  

Faye,Simple pub/sub messaging for the web

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.