         var request = URLRequest(url: webSocketUrl)
         request.applyDefaultWatchSocketSetting()
         let socket = WebSocket(request: request)
-        socket.onEvent = { [weak self] in
-            self?.handleWatchSocketEvent(
+        socket.onEvent = { [weak self, weak socket] in
+            guard let me = self, let socket = socket else { return }
+            me.handleWatchSocketEvent(
                 socket: socket,
                 event: $0,
                 completion: completion)

        request.applyDefaultMessageSocketSetting()
        let socket = WebSocket(request: request)
        resetTimeShiftVariables()
        socket.onEvent = { [weak self] in
            self?.handleTimeShiftMessageSocketEvent(
                socket: socket,
                event: $0,
                userId: userId,

        var request = URLRequest(url: url)
        request.applyDefaultMessageSocketSetting()
        let socket = WebSocket(request: request)
        socket.onEvent = { [weak self, weak socket] in
            guard let me = self, let socket = socket else { return }
            me.handleMessageSocketEvent(
                socket: socket,
                event: $0,
                userId: userId,
