Flask socketio blocked by something during time.sleep

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/codehunter

Our great sponsors
  • JetBrains - Developer Ecosystem Survey 2022
  • SonarQube - Static code analysis for 29 languages.
  • Scout APM - Less time debugging, more time building
  • Flask-SocketIO

    Socket.IO integration for Flask applications.

    I'm running a Flask server on my local machine and am using it to pull data from a serial port and display it in real time on a webpage with Flask-socketio. I followed the example here and am encountering an interesting behavior. I was able to replicate the results of the example, but when I alter the background_thread function to include reading and parsing data from the serial port, something seems to be blocking the socket from sending the data. My code correctly establishes a socket and opens the connection, and can even emit messages correctly at the beginning of the thread function, but once it hits a time.sleep(5), emitting doesn't work anymore. Here's the original thread function that works (and includes a time.sleep()!):

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts