I am working on webrtc project and I have client(s) with input video stream, client that will show input stream and server. I am using webrtc and websockets. Every client is connected to signaling server. I want to know how server can know if connected client is client with input video stream or it is client that will show some streams. Can I send some extra info in the moment of connecting client side to server? Client is written in Javascript and server in Python. Maybe I can use some parameters in socket.connect() method?
Server handling connecting:
@sio.event
async def connect(sid, environ):
print('Connected', sid)
sessionIDs.append(sid)
await sio.emit('ready', room=ROOM, skip_sid=sid)
sio.enter_room(sid, ROOM)
Connecting client to server:
socket.connect();
Just add your data as GET parameter in the websocket url, or use a differente path.
const socket = io("ws://localhost:3000?arg1=1&arg2=2");
// or
const socket = io("ws://localhost:3000/path1");
And on the server to get them:
io.on("connection", (socket) => {
console.log(socket.handshake.query); // prints { x: "42", EIO: "4", transport: "polling" }
});