सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
EventFlux एक Flutter/Dart पैकेज है जिसका उपयोग सर्वर-सेंट इवेंट (SSE) स्ट्रीम के प्रभावी प्रबंधन के लिए किया जाता है। यह वास्तविक समय के डेटा संचार को सरल बनाता है, जिसमें SSE एंडपॉइंट्स के साथ निरंतर कनेक्टिविटी, स्वचालित पुनर्संबंधन हैंडलिंग और संरचित डेटा प्रोसेसिंग शामिल है। नोटिफिकेशन, डैशबोर्ड या लाइव फीड जैसे लाइव अपडेट्स की आवश्यकता वाले एप्लिकेशन के लिए आदर्श, EventFlux न्यूनतम बॉलरप्लेट के साथ भरोसेमंद इवेंट डिलीवरी सुनिश्चित करता है। पैकेज में Android, iOS, macOS, Windows और Linux जैसे कई प्लेटफॉर्म का समर्थन है, जिससे यह क्रॉस-प्लेटफॉर्म रियल-टाइम एप्लिकेशन के लिए उपयुक्त है।
उपयोग
रियल-टाइम नोटिफिकेशन्स
लाइव डैशबोर्ड अपडेट्स
स्ट्रीमिंग डेटा फीड
चैट एप्लिकेशन्स
मॉनिटरिंग प्रणाली
मुख्य विशेषताएँ
स्वचालित पुनर्संबंध
स्ट्रीम जीवनचक्र प्रबंधन
प्लेटफॉर्म के अनुकूल समर्थन
घटना संभाल के लिए सरल API
एम्बेडेड त्रुटि पुनर्स्थापना
इनके लिए उपयुक्त
रियल-टाइम ऐप डेवलपर्स
बैकएंड-इंटीग्रेटेड फ्लटर ऐप्स
लाइव डेटा अपडेट की आवश्यकता वाले ऐप्स
सर्वर-भेजे गए इवेंट का उपयोग करने वाली टीमें
बहुप्लेटफॉर्म प्रोजेक्ट
विचार योग्य बातें
SSE-संगत बैकएंड की आवश्यकता है
सर्वर से क्लाइंट तक स्ट्रीमिंग तक सीमित
कोई निर्मित ऑथेंटिकेशन हैंडलिंग नहीं
नेटवर्क स्थिरता पर निर्भर करता है
जटिल पेलोड के लिए कस्टम पार्सिंग की आवश्यकता हो सकती है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
EventFlux
A Dart package for Server-Sent Events done right — WHATWG spec-compliant parsing, auto-reconnect with exponential backoff, request/response interceptors, mid-flight abort, idle timeout detection, and web platform support out of the box.
Platform Support
Android
iOS
Web
MacOS
Windows
Linux
✅
✅
✅
✅
❓
❓
Windows and Linux should work but haven't been battle-tested yet — PRs welcome if you get there first.
Features 🌟
📜 WHATWG SSE spec-compliant event stream parsing with persistent lastEventId and retry: field support
🔄 Auto-reconnect with linear or exponential backoff, random jitter, and configurable maxBackoff cap
🔗 Interceptor chain — hook into request, response, and error lifecycle stages
🛑 Mid-flight abort via a Future<void> trigger
⏱️ Idle timeout detection — drops the connection if no data arrives within a configured duration
🌐 Web platform support with CORS, credentials, and caching configuration via WebConfig
🔍 Event filtering by type using response.where()
📎 Multipart request support
🏗️ Singleton (EventFlux.instance) and multiple independent connections (EventFlux.spawn())
🔌 Pluggable HTTP clients via HttpClientAdapter
🧠 Smart error classification — only 5xx, 408, and 429 trigger auto-reconnect
Migrating from v2? FYI. 🔄
Here
If you're upgrading from v2, here's what changed:
Breaking
onReconnect callback signature changed from () to (int attempt, Duration delay)
Default request headers now include Cache-Control: no-store
Minimum Dart SDK raised to >=3.4.0, Flutter >=3.0.0
webConfig is now required when running on web
New in v3
EventFluxStatus.reconnecting status value
originalError and stackTrace fields on EventFluxException
Request/response/error interceptor chain via interceptors parameter
Mid-flight abort support via abortTrigger parameter
Idle timeout detection via connectionTimeout on ReconnectConfig
maxBackoff on ReconnectConfig to cap exponential backoff
WHATWG-compliant SSE parser with persistent lastEventId, retry: field support, and U+2028 sanitization
Installation 📦
dependencies:eventflux:^3.0.2-dev
Requires Dart SDK >=3.4.0 and Flutter >=3.0.0.
Usage 🔧
Basic Connection — Connect to an SSE endpoint in a few lines