get messages + client id from ws
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user