WIP: Testing WS

This commit is contained in:
Andras Bacsai
2022-05-11 16:15:34 +02:00
parent 3435f92fcb
commit 16b7c1708b
8 changed files with 783 additions and 13 deletions

View File

@@ -1,6 +1,17 @@
import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-node';
import { Server } from 'socket.io';
const webSocketServer = {
name: 'webSocketServer',
configureServer(server) {
const io = new Server(server.httpServer);
io.on('connection', (socket) => {
socket.emit('eventFromServer', 'Hello, World 👋');
});
}
};
const config = {
preprocess: preprocess(),
kit: {
@@ -10,6 +21,7 @@ const config = {
},
floc: true,
vite: {
plugins: [webSocketServer],
optimizeDeps: {
exclude: ['svelte-kit-cookie-session']
},