如何在Docker Compose网络中使WebRTC在主机和服务之间正常工作?

huangapple go评论61阅读模式
英文:

How to make WebRTC works between Host and a service in the docker compose network?

问题

这是一张图解释我面临的问题,正在尝试解决。

这阻止了我的浏览器通过WebRTC连接到运行在Docker容器中的服务,该容器属于Docker Compose的默认网络。

这是我迄今为止尝试过但没有成功的方法:

  • 使用STUNTURN服务器
  • 在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.

如何在Docker Compose网络中使WebRTC在主机和服务之间正常工作?

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.

huangapple
  • 本文由 发表于 2023年5月26日 12:21:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76337652.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定