Reputation: 97
I'm having some issues trying to connect to a Flask SocketIO implementation. I followed the examples and set up a server with the following code:
from flask_socketio import SocketIO, send
application = Flask(__name__)
socketio = SocketIO(application)
@socketio.on('message')
def doStuff(msg):
print(msg)
if __name__=="__main__":
socketio.run(application, port=8080)
and a client in Python:
import websocket
from websocket import create_connection
ws = create_connection("ws://SERVER_IP:8080/")
print(ws)
print("Sending 'Hello, World'...")
ws.send("Hello, World")
print("Sent")
print("Receiving...")
result = ws.recv()
print("Received '%s'" % result)
ws.close()
Nonetheless when I try to connect, I get WebSocketBadStatusException: Handshake status 200 OK. All the examples I've seen of connection to SocketIO involve having a static page with javascript but I want to use this as a Desktop application or use it with Kotlin.
What am I missing?
Upvotes: 0
Views: 6264