centrifugal / centrifuge-dart

Dart (Flutter) client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket

Home Page:https://pub.dartlang.org/packages/centrifuge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plan to support https server-sent-events?

kristofradi opened this issue · comments

https://centrifugal.dev/docs/transports/uni_sse

Would be great if the dart side would support the uni_sse communication as well

Have you any plan with this?

Hello, unidirectional transports in Centrifugo are supposed to work without custom real-time SDK from Centrifugal Labs side. We provide SDKs for bidirectional transports. The main intent of providing unidirectional transports was the ability to use them just with raw SSE, or WebSocket transports, without dependency on a more complex bidirectional SDK.

So I believe you can simply use sth like https://pub.dev/packages/flutter_client_sse or similar to consume events from Centrifugo unidirectional SSE. Just follow some semantics described in the doc for unidirectional transports: https://centrifugal.dev/docs/transports/overview#unidirectional

Of course you can wrap SSE client to simplify communication with Centrifugo - to manage some protocol conventions we have for unidirectional protocol inside the wrapper. I am not sure we can provide such official wrappers for different languages for Centrifugo users in near future. Probably in the bright future. But again - you can already use unidirectional SSE - just follow our unidirectional protocol description.