sveltekit-socket-io-example

A SvelteKit implementation of the Getting started chat tutorial on the Socket.io website chat.

Start

nvm use
npm i
npm run server

Differences vs Socket.io demo

The difference between this demo and the Socket.io one is that this demo sends messages through SvelteKit Form Actions instead of directly through Socket.io. This allows you to do things such as validate messages on the server side or reject them altogether before emitting them while still being able to import anything using Vite (such as $lib imports, etc)

Drawbacks

Currently the Vite dev server is not implemented, you have to test using production builds.

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes