1

I have a short question:

I have this simple flask Server running:

from flask import Flask, render_template
from flask_socketio import SocketIO, emit

app = Flask(__name__)
socketio = SocketIO(app)

@app.route('/')
def index():
    return render_template('index.html')

@socketio.on('message')
def handle_message(message):
    emit('message', message)

if __name__ == '__main__':
    app.run(debug=True, host='127.0.0.1', port=5000)
    socketio.run(app, logger=True, engineio_logger=True)

and I am sending this request in INSOMNIA

enter image description here

But I am always getting a 400. Can you tell me what I am doing wrong?

Many thanks

DrKnowing
  • 143
  • 1
  • 1
  • 6

1 Answers1

0

You are sending a WebSocket request to a Socket.io server. However, Insomnia doesn't support Socket.io, only WebSocket. You can see it here and here.

Diego Borba
  • 1,282
  • 8
  • 22