Skip to content

Instantly share code, notes, and snippets.

View alexvdvalk's full-sized avatar

Alex van der Valk alexvdvalk

View GitHub Profile
@alexvdvalk
alexvdvalk / +page.svelte
Created June 15, 2023 14:04
Sveltekit Directus Websockets Demo
<script lang="ts">
import { onMount } from 'svelte';
const url = 'ws://localhost:8055/websocket';
const access_token = 'your key';
const collection = 'posts';
onMount(() => {
const connection = new WebSocket(url);
connection.addEventListener('open', function () {