         request.applyDefaultMessageSocketSetting()
         let socket = WebSocket(request: request)
         resetTimeShiftVariables()
-        socket.onEvent = { [weak self] in
-            self?.handleTimeShiftMessageSocketEvent(
+        socket.onEvent = { [weak self, weak socket] in
+            guard let me = self, let socket = socket else { return }
+            me.handleTimeShiftMessageSocketEvent(
                 socket: socket,
                 event: $0,
                 userId: userId,

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

        stopAllTimers()

        [watchSocket, messageSocket].forEach {
            $0?.disconnect()
        }
        // To wait the completion of the above socket disconnect operation, skip to
        // immediate-nullify `watchSocket` and `messageSocket` here.
        // It's okay not to nullify them since they, in any case, are nullified
        // in the next open socket methods.
        // If we nullify them immediately here, these sockets are remained incompletely
        // in the status like `CloseWait`. And they are piled up and eventually cause
        // the network error for new connect requests with the message like
        // “No space left on device”.
        // You can confirm this "memory leak" in Network Activity Report in Xcode.

        live = nil
        isConnected = false
