Websocket option chain data not get

Live Option Chain let socket; let reconnectAttempts = 0; const maxReconnectAttempts = 5; // Prevent infinite reconnecting
    function connectWebSocket() {
        const accessToken = "eyJ0eXAiOiJKV1QiLCJrZXlfaWQiOiJza192MS4wIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiIzQUNXTDYiLCJqdGkiOiI2N2JjMDQyMzVjZjZiMDJhNGU0YjVlMGIiLCJpc011bHRpQ2xpZW50IjpmYWxzZSwiaWF0IjoxNzQwMzc1MDc1LCJpc3MiOiJ1ZGFwaS1nYXRld2F5LXNlcnZpY2UiLCJleHAiOjE3NDA0MzQ0MDB9.Y517rk0kQ7DftNp36n7SEBtVbgDKpjIMV32dPGDpUQs"; // Replace with actual Upstox token
        const wsUrl = `wss://api.upstox.com/ws/live/option_chain?token=${accessToken}`;
        socket = new WebSocket(wsUrl);

        socket.onopen = function () {
            console.log('✅ Connected to Upstox WebSocket');

            let subscriptionMessage = {
                action: "subscribe",
                params: {
                    instrumentKeys: ["NSE_INDEX|NIFTY MID SELECT"], // Update your key
                    expiry_date: "2025-02-27",
                    feedType: "full"
                }
            };

            socket.send(JSON.stringify(subscriptionMessage));
            reconnectAttempts = 0; // Reset reconnect counter on successful connection
        };

        socket.onmessage = function (event) {
            try {
                const data = JSON.parse(event.data);
                console.log('📊 Live Data:', data);
                updateOptionChain(data);
            } catch (error) {
                console.error("❌ Error parsing message:", error);
            }
        };

        socket.onerror = function (error) {
            console.error('❌ WebSocket Error:', error);
        };

        socket.onclose = function () {
            console.warn('⚠️ WebSocket Disconnected. Attempting reconnect...');

            if (reconnectAttempts < maxReconnectAttempts) {
                reconnectAttempts++;
                setTimeout(connectWebSocket, 5000);
            } else {
                console.error("❌ Max reconnect attempts reached. Please refresh manually.");
            }
        };
    }

    function updateOptionChain(data) {
        let tableBody = document.getElementById('optionChainBody');
        tableBody.innerHTML = ''; // Clear existing rows

        if (!data.option_chain) {
            console.warn("⚠️ No option chain data received");
            return;
        }

        data.option_chain.forEach(option => {
            let row = `<tr>
                <td>${option.strike_price}</td>
                <td>${option.CE ? option.CE.last_price : '-'}</td>
                <td>${option.CE ? option.CE.open_interest : '-'}</td>
                <td>${option.PE ? option.PE.last_price : '-'}</td>
                <td>${option.PE ? option.PE.open_interest : '-'}</td>
            </tr>`;
            tableBody.innerHTML += row;
        });
    }

    window.onload = connectWebSocket;
</script>

📈 Live Option Chain Data

Strike Price CE Last Price CE Open Interest PE Last Price PE Open Interest