Skip to content

Commit

Permalink
fix: shouldn't init websocket store in ws component
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanzyTHEbar committed Feb 3, 2023
1 parent 14923e0 commit 68534dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions GUI/ETVR/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import NewWindow from '@components/NewWindow'
import ToastNotificationWindow from '@components/Notifications'
import { setOpenModal } from '@src/store/ui/ui'
import { BUTTON } from '@static/custom/button'
import { generateWebsocketClients } from '@store/api/components/actions'
import { setWebsocketClients } from '@store/api/websocket'

const handleTitlebar = () => {
const titlebar = document.getElementsByClassName('titlebar')
Expand Down Expand Up @@ -85,6 +87,9 @@ const App = () => {
onMount(() => {
handleTitlebar()
handleAppBoot()
// TODO: call these after the MDNS service is up and running and discoveres the camera's
const clients = generateWebsocketClients()
setWebsocketClients(clients)
})
return (
<div class="App overflow-y-auto items-center">
Expand Down
6 changes: 0 additions & 6 deletions GUI/ETVR/src/components/WebSocket/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Image } from '@kobalte/core'
import { onMount, Show } from 'solid-js'
import icons from '@assets/images/index'
import { generateWebsocketClients } from '@store/api/components/actions'
import { setWebsocketClients } from '@store/api/websocket'
import { showCameraView } from '@store/ui/selectors'
import { initWebSocket } from '@utils/hooks/websocket'

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

const WebSocketHandler = (props: IProps) => {
onMount(async () => {
// TODO: call these after the MDNS service is up and running and discoveres the camera's
/* const clients = generateWebsocketClients()
setWebsocketClients(clients) */

initWebSocket()
})

Expand Down
1 change: 1 addition & 0 deletions GUI/ETVR/src/store/api/components/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const generateWebsocketClients = () => {
const clients = cameras().map((_, i) => {
return new WebSocket(`${LOCAL_HOST}:${PORT}/camera_${i + 1}`)
})
console.log('websocket clients', clients)
return clients
}

Expand Down

0 comments on commit 68534dd

Please sign in to comment.