diff --git a/app/routes/socket/connection.py b/app/routes/socket/connection.py index c05690c1..022cf9f5 100644 --- a/app/routes/socket/connection.py +++ b/app/routes/socket/connection.py @@ -1,13 +1,16 @@ import logging +from app.library.Events import EventBus, Events from app.library.router import RouteType, route LOG: logging.Logger = logging.getLogger(__name__) @route(RouteType.SOCKET, "connect", "socket_connect") -async def connect(sid: str): - pass +async def connect(notify: EventBus, sid: str): + notify.emit( + Events.CONNECTED, data={"sid": sid}, title="Client connected", message=f"Client '{sid}' connected.", to=sid + ) @route(RouteType.SOCKET, "disconnect", "socket_disconnect") diff --git a/ui/app/stores/SocketStore.ts b/ui/app/stores/SocketStore.ts index 2a7414dd..f65f10f3 100644 --- a/ui/app/stores/SocketStore.ts +++ b/ui/app/stores/SocketStore.ts @@ -264,20 +264,9 @@ export const useSocketStore = defineStore('socket', () => { on('connect', () => config.loadConfig(false)) - on('connected', (data: WSEP['connected']) => { - if (!data?.data) { - return - } - - if (data.data.folders) { - config.add('folders', data.data.folders) - } - - if ('number' === typeof data.data.history_count) { - stateStore.setHistoryCount(data.data.history_count) - } - + on('connected', () => { error.value = null + config.loadConfig(false) }) on('item_added', (data: WSEP['item_added']) => { diff --git a/ui/app/types/sockets.d.ts b/ui/app/types/sockets.d.ts index ad576c98..a7bdfe24 100644 --- a/ui/app/types/sockets.d.ts +++ b/ui/app/types/sockets.d.ts @@ -20,11 +20,7 @@ export type WSEP = { connect: null disconnect: null connect_error: { message?: string } - connected: EventPayload<{ - folders?: string[] - history_count?: number - queue?: Record - }> + connected: EventPayload<{ sid: string }> item_added: EventPayload item_updated: EventPayload item_cancelled: EventPayload