You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PyCharm启动/调试非Socket项目时出现socket.io连接错误的解决方法求助

Fixing Unwanted Socket.io Polling Requests in Non-Socket Projects

I ran into this exact frustrating issue a while back when switching between a Socket.io project and a non-Socket project in PyCharm—rebooting my laptop every time was such a hassle! Here are the practical solutions that worked for me, no full system restart required:

1. Clean Up PyCharm's Stale Run Configurations

PyCharm often hangs onto leftover run configurations from old projects, which can cause cross-project configuration leaks. Here's how to fix it:

  • Go to Run > Edit Configurations
  • Scan for any run configurations linked to your old Socket.io project (they might still be lurking even if you're working on a completely new project)
  • Delete those outdated configurations, click Apply then OK
  • Do a quick restart of PyCharm (just the IDE, not your whole laptop) to apply the changes

2. Flush Browser Cache & Unregister Service Workers

The polling request looks like it's coming from your browser, so cached assets or leftover service workers might be trying to reconnect to the old socket endpoint:

  • Open your browser's dev tools (F12), navigate to the Application tab
  • Under Storage, click Clear site data (make sure to target the domain your current project is running on)
  • Head to Service Workers and unregister any workers tied to your old Socket.io project
  • Do a hard refresh (Ctrl+Shift+R on Windows/Linux, Cmd+Shift+R on macOS) to load the project without cached baggage

3. Terminate Leftover Python Processes

Sometimes the old Socket.io server process doesn't fully shut down when you stop it in PyCharm, running in the background and causing conflicts:

  • Windows: Open Task Manager, find any python.exe or pythonw.exe processes linked to your old Socket project and end them
  • macOS/Linux: Open Terminal, run ps aux | grep python to find the process ID (PID) of the leftover server, then kill it with kill <PID> (use kill -9 <PID> if it refuses to terminate)

4. Check for Accidental Dependency Leaks

Double-check your current project's dependencies—you might have accidentally installed Socket.io-related packages when copying code from the old project:
Run this command in your project's virtual environment to check:

pip freeze | grep socketio

If you see unexpected packages like python-socketio or flask-socketio, uninstall them with:

pip uninstall python-socketio flask-socketio

These steps should cover most cases where leftover cache, configurations, or background processes are triggering those unwanted socket.io requests. I haven't had to reboot my laptop since using these fixes!

内容的提问来源于stack exchange,提问作者Carter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 20:24:05