Skip to content

Commit 68534dd

Browse files
committed
fix: shouldn't init websocket store in ws component
1 parent 14923e0 commit 68534dd

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

GUI/ETVR/src/app.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import NewWindow from '@components/NewWindow'
88
import ToastNotificationWindow from '@components/Notifications'
99
import { setOpenModal } from '@src/store/ui/ui'
1010
import { BUTTON } from '@static/custom/button'
11+
import { generateWebsocketClients } from '@store/api/components/actions'
12+
import { setWebsocketClients } from '@store/api/websocket'
1113

1214
const handleTitlebar = () => {
1315
const titlebar = document.getElementsByClassName('titlebar')
@@ -85,6 +87,9 @@ const App = () => {
8587
onMount(() => {
8688
handleTitlebar()
8789
handleAppBoot()
90+
// TODO: call these after the MDNS service is up and running and discoveres the camera's
91+
const clients = generateWebsocketClients()
92+
setWebsocketClients(clients)
8893
})
8994
return (
9095
<div class="App overflow-y-auto items-center">

GUI/ETVR/src/components/WebSocket/index.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Image } from '@kobalte/core'
22
import { onMount, Show } from 'solid-js'
33
import icons from '@assets/images/index'
4-
import { generateWebsocketClients } from '@store/api/components/actions'
5-
import { setWebsocketClients } from '@store/api/websocket'
64
import { showCameraView } from '@store/ui/selectors'
75
import { initWebSocket } from '@utils/hooks/websocket'
86

@@ -27,10 +25,6 @@ const LoaderHandler = (props: IProps) => {
2725

2826
const WebSocketHandler = (props: IProps) => {
2927
onMount(async () => {
30-
// TODO: call these after the MDNS service is up and running and discoveres the camera's
31-
/* const clients = generateWebsocketClients()
32-
setWebsocketClients(clients) */
33-
3428
initWebSocket()
3529
})
3630

GUI/ETVR/src/store/api/components/actions.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const generateWebsocketClients = () => {
77
const clients = cameras().map((_, i) => {
88
return new WebSocket(`${LOCAL_HOST}:${PORT}/camera_${i + 1}`)
99
})
10+
console.log('websocket clients', clients)
1011
return clients
1112
}
1213

0 commit comments

Comments
 (0)