Dart 語言實現的輕量級消息服務器:Ripple
Ripple 是一個為 Dart 語言實現的輕量級消息服務器。當前支持 STOMP 消息協議。
利用 Ripple 服務器來提供一個 WebSocket 連接服務,示例:
HttpServer httpServer;
RippleServer rippleServer;
...
httpServer.listen((request) {
if (...) { //usually test request.uri to see if it is mapped to WebSocket
WebSocketTransformer.upgrade(request).then((WebSocket webSocket) {
rippleServer.serveWebSocket(webSocket);
});
} else {
// Do normal HTTP request processing.
}
});
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!