DEV Community

Cover image for SvelteKit with SocketIO in Production

SvelteKit with SocketIO in Production

Shivam Meena on July 30, 2022

Read if: You wanna learn how to use SocketIO with SvelteKit. Resources SvelteKit: Docs SocketIo: Docs Vite: Docs Exten...
Collapse
 
zeroql profile image
ZeroQLi

Eagerly waiting for the 2nd part

Collapse
 
theether0 profile image
Shivam Meena

Thanks you for your support. I'll try as soon as possible to write second part after i cover all the sveltekit changes.

Collapse
 
haond10adp profile image
Nguyễn Đức Hào

I'm looking forward to this

Collapse
 
fxmt2009 profile image
Ade

Anyone aware of a github repo with this setup?
Or a github with expressjs server integrated with sveltekit?

I'm trying to spin my own cutom express server but I get errors. It seems that the handlers.js is not passing anything to the expressjs once I add app.use(handlers) after I require handlers.js on top of the express server file of course.

Collapse
 
theether0 profile image
Shivam Meena
Collapse
 
jaodevtobi profile image
Tobi kin

Going through this in 2023 just wondering is they a better way to do this now? Or ..

Collapse
 
theether0 profile image
Shivam Meena

It depends on your need. What you wanna work in what is goal with it.

Collapse
 
jaodevtobi profile image
Tobi kin

Just for real time conversation on An online platform.

Is it possible without using expressjs like one of the +server files or something similer

Thread Thread
 
theether0 profile image
Shivam Meena

not yet. We have to extend it to use web-sockets. It works only for node adapter.

Thread Thread
 
jaodevtobi profile image
Tobi kin

Thanks for the reply..

Collapse
 
badalya1 profile image
badalya1

This is not so good, there is no way to get your sicketio instance into the apps server side code.

Collapse
 
hansamann profile image
Sven Haiges

the example works but how would I send a server side message from an api call in svelte to all in a room? i need to get access to the io object for this... how can I share it an svelte api?

Collapse
 
theether0 profile image
Shivam Meena