0

I am trying to finish cs50w project 2 but I can't get socket.io to connect (at least i think that is the problem)

I went into the source file and tried to recreate their example from vote1.

This is not my code. It is the course example so there shouldn't be any bugs.

Here is their example copy and pasted from src5.

index.js

index.html

application.py

and here is the error I keep getting.

terminal flask app dev tools

I am just starting out programing and I have no idea how to solve this problem. If I can't get the courses example code to run I definitely can't figure out how to create my own.

0

BLUF (Bottom Line Up Front): Suggest you "solve" this problem a different way. Do it in the IDE.

There are a lot of moving parts (dependencies) here: js socket.io, flask-SocketIO, OS, browser, proxy, etc., etc. A "simple" internet search for "flask-socketio 400 bad request" returns hundreds (thousands?) of avenues of investigation. That will surely shift your focus from making progress on the class material.

There are two things you need to do to use the IDE for this project:

  • pip3 install Flask-SocketIO
  • use flask run --no-reload to start flask (credit here)

Other random questions:

  • Is there any information in the flask log that could give you more information or at least google fodder?
  • The console errors are offering more information with the ►. Anything interesting there?
  • Did you literally copy/paste from src5? If so, suggest you install directly from the zip file. copy/paste just offers another opportunity for bugs to creep in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .