英文:
How to make WebRTC works between Host and a service in the docker compose network?
问题
这是一张图解释我面临的问题,正在尝试解决。
这阻止了我的浏览器通过WebRTC连接到运行在Docker容器中的服务,该容器属于Docker Compose的默认网络。
这是我迄今为止尝试过但没有成功的方法:
- 使用STUN和TURN服务器
- 在Docker Compose中为两个容器使用extra_hosts选项,值为:host.docker.internal:host-gateway
所以我的问题是:为什么iceConnection从checking状态转变为disconnected状态,更重要的是,如何解决这个问题?
注意:
我假设在Web浏览器中运行的代码中的WebRTCPeerconnection无法连接到容器中的服务打开的套接字,因为主机和Docker Compose项目不在同一网络中。我本来以为TURN中间人会解决这个问题,但显然不是这样。
英文:
Here is a diagram explaining the issue I am facing and trying to solve.
This prevents my browser to peer connect, through webRTC, to a service running in a docker container which belongs to the docker-compose default network.
Here is what I tried so far with no success:
- Using STUN and a TURN servers
- Using the extra_hosts option in docker compose for both containers with the following value: host.docker.internal:host-gateway
So my question is: why the iceConnection transitions from checking to disconnected states, and more importantly, how to solve this?
Note:
My assumption is that the WebRTCPeerconnection from the code running in the web browser fails to connect to the socket opened by the service running in the container because Host and Docker Compose project are not in the same network. I would have thought that the TURN middleman would solve this though, which is not the case apparently.
答案1
得分: 0
这实际上与 Docker 无关。
在浏览器中运行的代码向目标服务发送了错误的 RTC offer 负载。
英文:
This had actually nothing to do with Docker.
Code running in Browser was sending the wrong RTC offer payload to the destination service.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论