{"repo":"binaryminds/react-native-sse","free":true,"listed":false,"github":"https://github.com/binaryminds/react-native-sse","clone":"git clone https://github.com/binaryminds/react-native-sse.git","description":"Event Source implementation for React Native. Server-Sent Events (SSE) for iOS and Android 🚀","language":"JavaScript","stars":374,"topics":["eventsource","sse","typescript","android","ios","react-native","event-source"],"license":"MIT","category":"mobile-apps","readme_excerpt":"React Native EventSource (Server-Sent Events) 🚀 Your missing EventSource implementation for React Native! React-Native-SSE library supports TypeScript. 💿 Installation We use XMLHttpRequest to establish and handle an SSE connection, so you don't need an additional native Android and iOS implementation. It's easy, just install it with your favorite package manager: Yarn NPM 🎉 Usage We are using Server-Sent Events as a convenient way of establishing and handling Mercure connections. It helps us keep data always up-to-date, synchronize data between devices, and improve real-time workflow. Here you have some usage examples: Import Connection and listeners Done vs Close done events will fire when server closes the connection. By default, the client will automatically reconnect when this happens. You can disable reconnections by setting the pollingInterval option to 0 . close events will fire when the connection is terminated by the client, using .close() . Headers and params If you want to use Bearer token and/or topics, look at this example (TypeScript): Usage with React Redux Since the listener is a closure it has access only to the component values from the first render. Each subsequent render has no effect on already defined listeners. If you use Redux you can get the actual value directly from the store instance. 📖 Configuration Options 🚀 Advanced usage with TypeScript Using EventSource you can handle custom events invoked by the server: Using one listener for all events:","default_branch":null,"files":null,"tree":[],"storefront":"/r/binaryminds","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/binaryminds/react-native-sse/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}