This is an example repo showing how to implement SSEs in Sveltekit using the Web Streams (server) and EventSource (client) APIs.
It's a naive implementation, and WebSockets are probably a better choice for a chat application, but maybe this'll save someone else some research.
Chats are ephemeral, stored in server memory - check out the surreal
branch of this repo for a version using an actual database.
-
Clone the repo and install dependencies.
-
npm run build
andnpm run preview
OR
npm run dev
If you have any feedback, questions, dark secrets, etc., please submit an issue or PR!
MIT