floatinghotpot / socket.io-unity

socket.io client for Unity, power game client with node.js back-end
494 stars 75 forks source link

Socket.IO not working #46

Closed vitiacat closed 4 years ago

vitiacat commented 4 years ago

I use the Heroku hosting (python, tornado WebSocket) Unity: var socket = IO.Socket("ws://******.herokuapp.com/"); socket.On(Socket.EVENT_CONNECT, () => { socket.Emit("hi"); Debug.Log("connected!"); }); socket.On("hi", (data) => { Debug.Log(data); socket.Disconnect(); }); socket.Connect(); Server: `class EchoWebSocket(websocket.WebSocketHandler): def open(self): print("Websocket Opened")

def on_message(self, message):
    self.write_message(u"You said: %s" % message)

def on_close(self):
    print("Websocket closed")

application = tornado.web.Application([(r"/", EchoWebSocket),])

if name == "main": application.listen(int(os.environ.get("PORT", 33510))) tornado.ioloop.IOLoop.instance().start() ` In the logs I get this: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=637157216530205865-0&b64=1" host=kotikgames.herokuapp.com request_id=81d4f05f-621e-4142-929b-8c0f809d9c11 fwd="37.214.61.46" dyno=web.1 connect=1ms service=3ms status=404 bytes=240 protocol=http