You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spent a good 5 days on this project. It is HAS to be mainly due to my lack of experience and knowledge.
Here's what I am able to completed:
The server and client will use WebSockets. ✅
The client will send an offer to the server through WebSocket. ✅
The server will receive the offer and send an answer to the client through ws. ✅
The client will receive the answer. ✅
The client will send ICE manually through ws (MANUAL ONLY: you will see this in the code snippet I'll share shortly). ⚠️
The data channel should open. 🛑 (Couldn't reach to this point on python to python)
The above setup works for communication between Python and JavaScript (JS) clients and the Python server. It's functional and implemented in the current server.py.
The issue arises when communicating between two Python instances (Let's call it Py2Py). There's no 'ICE generator' available for Py2Py, unlike in JavaScript, where it's automatically passed. So, I manually update the ICE as shown below:
gatherer = RTCIceGatherer()
await gatherer.gather()
local_candidates = gatherer.getLocalCandidates()
print(local_candidates[0])
candidate_dict = {"foundation": local_candidates[0].foundation,
"component": int(local_candidates[0].component),
"protocol": local_candidates[0].protocol,
"priority": int(local_candidates[0].priority),
"ip": local_candidates[0].ip,
"port": int(local_candidates[0].port),
"type": local_candidates[0].type,
"sdpMid": 0, # I swear if this bites me in the future...
"sdpMLineIndex": 0,
"relatedAddress": local_candidates[0].relatedAddress,
"relatedPort": local_candidates[0].relatedPort,
'python': 1}
data = {"type": "candidate", "candidate": candidate_dict}
await websocket.send(json.dumps(data))
This manual part helped me move forward, but unfortunately, the data channel remains unopened without any result.
The communication between JS and Python works flawlessly, EVEN with messages printed from JS or 'data channel opened' output displayed in Python.
Now, the question is: How can we generate ICE data for the python server to obtain? My manual ICE update might not be effective.
I've included the full scripts in the attached zip for those interested in getting new idea on their own Py2Py project.
I spent a good 5 days on this project. It is HAS to be mainly due to my lack of experience and knowledge.
Here's what I am able to completed:
The above setup works for communication between Python and JavaScript (JS) clients and the Python server. It's functional and implemented in the current server.py.
The issue arises when communicating between two Python instances (Let's call it Py2Py). There's no 'ICE generator' available for Py2Py, unlike in JavaScript, where it's automatically passed. So, I manually update the ICE as shown below:
This manual part helped me move forward, but unfortunately, the data channel remains unopened without any result.
The communication between JS and Python works flawlessly, EVEN with messages printed from JS or 'data channel opened' output displayed in Python.
Now, the question is: How can we generate ICE data for the python server to obtain? My manual ICE update might not be effective.
I've included the full scripts in the attached zip for those interested in getting new idea on their own Py2Py project.
troubleshoot.zip
P.S.
I tried to put this discussion and it won't let me post there. can you transfer this to discussion? This belongs to discussion
The text was updated successfully, but these errors were encountered: