{"repo":"moishinetzer/remix-live-loader","free":true,"listed":false,"github":"https://github.com/moishinetzer/remix-live-loader","clone":"git clone https://github.com/moishinetzer/remix-live-loader.git","description":"Utility helpers and a practical demonstration of using Server-Sent Events for real-time data updates in Remix","language":"TypeScript","stars":50,"topics":["remix","server-sent-events","typescript"],"license":null,"category":"saas-starters-boilerplates","readme_excerpt":"Remix Live Loader Introduction This repo demonstrates how to use Server-Sent Events to invalidate data on other clients in real-time. It showcases a practical implementation of real-time data updates across multiple clients, ensuring that all users see the most current data as it changes. For the best demo of this repo, how it was implemented, and how to use it, I highly recommend watching the following video: Server-Sent Events in Remix Getting Started To implement this functionality, incorporate the following files into your app. - app/utils/emitter.server.ts : Manages the event emission across various clients. - app/utils/create-event-stream.server.ts : Sets up an event stream for listening to specific events. - app/utils/use-live-loader.ts : Extends useLoaderData for real-time data revalidation. Usage emitter An EventEmitter singleton used across all requests to emit events to the event stream. Example use case: Emitting a 'new-message' event when a new chat message is received. createEventStream This function initializes an event stream that listens for the specified event name. It sends an event with the current timestamp as data and includes cleanup logic for memory optimization. useLiveLoader This function extends useLoaderData, automatically revalidating all data upon event stream triggers. Ideal for real-time data updates on pages like live chat or notifications. Listens to events being emitted to the current path + /stream and revalidates the data when events are r","default_branch":null,"files":null,"tree":[],"storefront":"/r/moishinetzer","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/moishinetzer/remix-live-loader/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."}