【问题标题】:Why am I getting Websocket Error in WebRTC Conference?为什么我在 WebRTC 会议中收到 Websocket 错误?
【发布时间】:2020-06-01 16:17:32
【问题描述】:

我正在尝试 AntMedia EE 试用版

我正在使用位于 https://ant.techrova.in/LiveApp/conference.html

(内置演示)

加入房间被禁用,我检查控制台

我收到这些错误

到 'wss://ant.techrova.in/LiveApp/websocket' 的 WebSocket 连接 失败:WebSocket 握手期间出错:意外的响应代码: 404

不知道怎么解决?

这是我的 apache 代理配置

对于http

<VirtualHost *:80>
        ServerName ant.techrova.in
        ProxyPreserveHost On

        ProxyPass / http://127.0.0.1:5080/
        ProxyPassReverse / http://127.0.0.1:5080/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =ant.techrova.in
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]


</VirtualHost>

对于 https

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName ant.techrova.in
        ProxyPreserveHost On

        ProxyPass / http://127.0.0.1:5080/
        ProxyPassReverse / http://127.0.0.1:5080/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined



SSLCertificateFile /etc/letsencrypt/live/ant.techrova.in/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ant.techrova.in/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

=====================

请帮忙解决这个问题

【问题讨论】:

    标签: sockets https websocket webrtc ant-media-server


    【解决方案1】:

    请启用以下模块:

    a2enmod proxy proxy_http proxy_wstunnel
    

    在您的 conf 文件中添加以下行。

    RewriteEngine on
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /(.*)           ws://localhost:5080/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /(.*)           http://localhost:5080/$1 [P,L]
    ProxyPass / http://localhost:5080/
    ProxyPassReverse / http://localhost:5080/
    

    之后重启apache2服务如下:

    systemctl restart apache2
    

    【讨论】:

    • 我执行了所有步骤,但我仍然收到相同的控制台错误,我激活了所有模块并使用 apachectl -M 在conf文件中添加了这些行来检查它们。但仍然遇到同样的错误
    • 我编辑了我的答案。我们在测试服务器中尝试了这个问题。你能再检查一下吗?
    • 是的,套接字错误已修复。但是除了自己的视频还能看到别人吗?为什么?
    • 是的,默认设置下每个人都可以访问您的视频。您可以在流媒体服务器中启用一些安全功能,并且可以阻止未经授权的访问。请在此处查看 AMS 流安全文档 -> github.com/ant-media/Ant-Media-Server/wiki/…
    • 我按照步骤成功了。我还为流媒体打开了 UDP 50000/65000 端口.....非常感谢
    猜你喜欢
    • 2020-11-05
    • 1970-01-01
    • 2020-11-05
    • 2018-06-22
    • 2020-01-12
    • 2016-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多