[Python] INFO: 127.0.0.1:40028 - "GET /socket.io/?EIO=4&transport=polli

Discussão em 'Python' iniciado por Stack, Setembro 2, 2025.

  1. Stack

    Stack Membro Participativo

    getting this error INFO: 127.0.0.1:40028 - "GET /socket.io/?EIO=4&transport=polling&t=sziu51pf HTTP/1.1" 404 Not Found INFO: 127.0.0.1:40038 - "GET /socket.io/?EIO=4&transport=polling&t=szmp99dg HTTP/1.1" 404 Not Found


    import React, { useEffect, useState } from 'react';
    import './App.css';

    function App() {
    // Estado para guardar el objeto Machine
    const [machines, setMachines] = useState([{ nombre: 'Loading...', valor: 0 }]);

    useEffect(() => {
    const ws = new WebSocket('ws://localhost:8000/ws/machines');
    ws.onopen = () => {
    console.log('WebSocket connection opened');
    };

    ws.onmessage = (event) => {
    try {
    const data = JSON.parse(event.data);
    if (Array.isArray(data)) {
    setMachines(data);
    }
    } catch (error) {
    console.error('Error parsing WebSocket message:', error);
    }
    };

    ws.onclose = () => {
    console.log('WebSocket connection closed');
    };

    ws.onerror = (error) => {
    console.error('WebSocket error:', error);
    };

    return () => ws.close();
    }, []);

    return (
    <div className="App">
    <header className="App-header">
    <h1>State of the Machines</h1>
    <ul>
    {machines.map((machine, index) => (
    <li key={index}>
    <strong>Name:</strong> {machine.name} <br />
    <strong>Value:</strong> {machine.value}
    </li>
    ))}
    </ul>
    </header>
    </div>
    );
    }

    export default App;


    i tried to fix it with ai yet kept getting this error also read docs

    Continue reading...

Compartilhe esta Página