danni / uwebsockets

Micropython websockets implementation
MIT License
192 stars 44 forks source link

SocketIO Server Doesn't work. #21

Open thevobos opened 1 year ago

thevobos commented 1 year ago

Hi,

I'm using Socket.io with Node JS and I'm getting an error. Please can you give an example of how I should set a socket server with Socket.io server or nodejs?

thevobos commented 1 year ago

i getting a an error message

Error Code :

Traceback (most recent call last): File "main.py", line 83, in File "main.py", line 48, in do_connect File "main.py", line 26, in hello File "usocketio/client.py", line 81, in connect File "usocketio/client.py", line 45, in _connect_http AssertionError: b'HTTP/1.1 400 Bad Request'

My Socket Server Code const express = require('express'); const app = express(); const http = require('http'); const server = http.createServer(app); const { Server } = require("socket.io"); const io = new Server(server);

app.get('/', (req, res) => { res.send("selam"); });

io.on('connection', (socket) => { console.log('a user connected'); });

server.listen(3009, () => { console.log('listening on *:3000'); });

danni commented 1 year ago

Hi, I'm afraid all of this code is unsupported. Especially the SocketIO part. I don't know if SocketIO has changed any part of their requesting handshake.

The first step is to turn on logging of your requests (i.e. in Wireshark) and see if they make sense. Compare them to a Node SocketIO client and see what's different.

thevobos commented 1 year ago

Thank you for your quick response,

I tested the whole platform. socket Io, Flask SocketIo. only the web socket is working. isn't working stable. i will use thr mqtt.