Using Prisma nicely with SvelteKit (With Pulse)
I realise this could be asked in either Discord but this feels the correct one. Prisma works beautifully on the
*.server.*
pages. Absolutely no issue. But the issue I'm having is how to correctly set up the streaming. A Google tells me you can set up Websockets etc so it seems like it should be doable. But I am getting stumped at how to integrate Pulse correctly.
Wondering if anyone else has smart ideas?2 Replies
To setup Pulse with Sveltekit, You would need to:
1. Create a WebSocket Server: Use a library like socket.io to set up a WebSocket server. Broadcast Pulse stream events to connected clients using io.emit().
2. Integrate with SvelteKit: You can either run the webSocket server separately from SvelteKit or attach the webSocket server to the SvelteKit server by modifying the server entry point.
3. Connect the Frontend: Use socket.io-client in your SvelteKit app to establish a connection and listen for events from the websocket server and update the UI in real-time.
I'm adding a note to create a Sveltekit Pulse example app in our example repo
Thank you ❤️