File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
drivers/SmartThings/sonos/src/api Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,16 @@ cosock.spawn(function()
4444 if wss ~= nil then
4545 log .trace (string.format (" Closing websocket for player %s" , unique_key ))
4646 wss :close (CloseCode .normal (), " Shutdown requested by client" )
47+ local ws_id = wss .id
48+ for _ , uuid in ipairs ((listener_ids_for_socket [ws_id ] or {})) do
49+ local listener = listeners [uuid ]
50+
51+ if listener ~= nil then
52+ listener .on_close (uuid )
53+ end
54+ listeners [uuid ] = nil
55+ end
56+ listener_ids_for_socket [ws_id ] = nil
4757 end
4858 websockets [unique_key ] = nil
4959 end
@@ -292,17 +302,7 @@ function SonosWebSocketRouter.close_socket_for_player(target)
292302 local ws = websockets [target ]
293303
294304 if ws ~= nil then
295- local ws_id = ws .id
296305 table.insert (pending_close , target )
297- for _ , uuid in ipairs ((listener_ids_for_socket [ws_id ] or {})) do
298- local listener = listeners [uuid ]
299-
300- if listener ~= nil then
301- listener .on_close (uuid )
302- end
303- listeners [uuid ] = nil
304- end
305- listener_ids_for_socket [ws_id ] = nil
306306 return true
307307 else
308308 return nil , string.format (" No currently open connection for %s" , target )
You can’t perform that action at this time.
0 commit comments