socket.io - Two functions reach the identical socketio.emit line. One emits the other doesn't. Can't wrap my hea

admin2025-04-15  3

from flask import Flask, send_from_directory
from flask_socketio import SocketIO
import time
import threading
import os
import serial

# Serial Configuration (Modify COM Port if needed)
SERIAL_PORT = "COM3"
BAUD_RATE = 115200

app = Flask(__name__, static_folder="../frontend/dist")
socketio = SocketIO(app, cors_allowed_origins="*")  # Allow all origins for development

# Serve the index html
@app.route("/")
def index():
    return send_from_directory(app.static_folder, "index.html")

# Serve static files (JS, CSS, etc.) from the Vite build
@app.route("/<path:path>")
def static_files(path):
    return send_from_directory(app.static_folder, path)

def emit_data():
    print("
转载请注明原文地址:http://www.anycun.com/QandA/1744723821a86737.html