Skip to content

Commit 6795df7

Browse files
committed
fix: harcode stream url and use URLSearchParams
1 parent 52f9774 commit 6795df7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

frontend/src/lib/components/StreamListener.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
const connect = () => {
1818
console.log('Attempting Connection');
1919
const cleanedUrl = PUBLIC_BACKEND_URL.replace(/\/+$/, '');
20-
const cleanedEndpoint = PUBLIC_STREAM_URL.replace(/^\/+/, '');
21-
const jwt = get(JwtTokenStore);
20+
const params = new URLSearchParams({ team_id: $TeamStore!.id })
21+
eventSource = new EventSource(`${cleanedUrl}/api/eventlistener?${params.toString()}`);
2222
23-
eventSource = new EventSource(`${cleanedUrl}/${cleanedEndpoint}?team_id=${$TeamStore?.id}`);
23+
eventSource.onopen = (event) => {
24+
alert('Connection Established')
25+
}
2426
2527
eventSource.onmessage = (event) => {
2628
alert(event.data);

0 commit comments

Comments
 (0)