get messages + client id from ws

This commit is contained in:
2025-06-07 13:36:08 +02:00
parent 988534ed01
commit 85a223d573
7 changed files with 75 additions and 30 deletions

View File

@@ -4,14 +4,17 @@
import { ChatSocket } from '$lib/socket';
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import { setMessageStore } from '$lib/message.svelte';
let { children } = $props();
let socket;
const store = setMessageStore([]);
onMount(() => {
if (browser) {
socket = new ChatSocket('ws://localhost:3000/ws');
socket = new ChatSocket('ws://localhost:3000/ws', store);
}
});
</script>