I'm new with Flask-SocketIO and I'm struggling to set up Socket IO connection between my Flask server and my Javascript (React) client.
Anyhow, I was not able to set up the connection and start to emit messages. This is what log says:
127.0.0.1 - - [20/Aug/2018 15:33:03] "GET /socket.io/?EIO=3&transport=polling&t=MLNKwf9 HTTP/1.1" 200 381 0.000659 127.0.0.1 - - [20/Aug/2018 15:33:03] "POST /socket.io/?EIO=3&transport=polling&t=MLNKwfK HTTP/1.1" 400 218 0.000203 These log messages recur on every 5 seconds.
Here's my code in back-end:
app = Flask(__name__, static_url_path=None) socket_io = SocketIO(app) @socket_io.on('connect', namespace='/chat') def test_connect(): print('connected') And in client side:
import SocketIOClient from 'socket.io-client'; and in constructor I do this:
const uri = `http://${localhost}:5000/api/v1.0/chat`; this.socket = SocketIOClient(uri); What do I wrong?
Any help would be appreciated!