简体   繁体   English

Kurento - WebSocket连接失败

[英]Kurento - WebSocket Connection failed

I am trying to run the Javascript recording example of Kurento WebRTC as seen in: 我正在尝试运行Kurento WebRTC的Javascript录制示例,如下所示:

http://doc-kurento.readthedocs.org/en/stable/tutorials/js/tutorial-recorder.html http://doc-kurento.readthedocs.org/en/stable/tutorials/js/tutorial-recorder.html

I have setup Kurento on a Ubuntu machine and it is running OK. 我在Ubuntu机器上安装了Kurento,运行正常。 The service has started as well. 该服务也已启动。 Furthermore I tested the Java based example and it was running without any issues. 此外,我测试了基于Java的示例,它运行时没有任何问题。

The js recording example failed with the following error: js录制示例失败,出现以下错误:

Mixed Content: The page at ' https://ABCDEF ' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://XYZ:8433/'. 混合内容:' https:// ABCDEF '页面是通过HTTPS加载的,但是尝试连接到不安全的WebSocket端点'ws:// XYZ:8433 /'。 This request has been blocked; 此请求已被阻止; this endpoint must be available over WSS 此端点必须通过WSS可用

I changed the ws_uri variable to point to a secure web socket: 我将ws_uri变量更改为指向安全的Web套接字:

ws_uri: 'wss://XYZ:8433',

However, I get the following error now: 但是,我现在收到以下错误:

WebSocket connection to 'wss://XYZ:8433/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

The kurento server is secured to run over HTTPS using letsencrypt. 使用letsencrypt保护kurento服务器以通过HTTPS运行。 I used the following instructions to secure the server: 我使用以下说明来保护服务器:

https://doc-kurento.readthedocs.org/en/latest/mastering/securing-kurento-applications.html https://doc-kurento.readthedocs.org/en/latest/mastering/securing-kurento-applications.html

However, on the above example it asks to concatenate the following crt files: 但是,在上面的示例中,它要求连接以下crt文件:

cat signing-ca.crt subordinate-ca.crt server.crt > server.pem

I am confused here though, since I could not find the above files. 我在这里很困惑,因为我找不到上面的文件。 Letsencrypt generates the following .pem files for me: Letsencrypt为我生成以下.pem文件:

cert.pem, chain.pem, fullchain.pem, privkey.pem cert.pem,chain.pem,fullchain.pem,privkey.pem

Should one of the above files be used in the kurento.json.conf file? 是否应该在kurento.json.conf文件中使用上述文件之一?

You already have a certificate chain files, and as the documentation mentions: 您已有证书链文件,并且文档中提到:

If this PEM certificate is a signed certificate (by a Certificate Authority such as Verisign), then you are done. 如果此PEM证书是签名证书(由证书颁发机构,如Verisign),那么您就完成了。

Kurento needs both the private key and the full chain, but these files are generated separately when using letsencrypt. Kurento需要私钥和完整链,但这些文件在使用letsencrypt时是单独生成的。 You can concatenate the fullchain.pem and your privkey.pem with cat privkey.pem fullchain.pem > server.pem 您可以使用cat privkey.pem fullchain.pem > server.pem连接fullchain.pemprivkey.pem

Configure Kurento to use your new file server.pem as its certificate : 配置Kurento使用新文件server.pem作为其certificate

"secure": {
  "port": 8433,
  "certificate": "server.pem",
  "password": ""
}

For the record, if you were to sign your own certificate , you would have used cat in order to create a certificate chain as following: 为了记录,如果您要签署自己的证书 ,您将使用cat来创建证书链,如下所示:

root-ca ==> signing-ca ==> subordinate-ca ==> server root-ca ==> signing-ca ==> subordinate-ca ==> server

Your kurento.json.conf file is probably fine. 你的kurento.json.conf文件可能没问题。

I ran into this issue a while back. 我不久前遇到了这个问题。 The problem is that java is blocking websocket tunneling for security purposes. 问题是java出于安全目的阻止了websocket隧道。 You need to add setAllowedOrigins(*) within the registerWebSocketHandlers method. 您需要在registerWebSocketHandlers方法中添加setAllowedOrigins(*)。 Note: this is not secure and should not be used in a production environment. 注意:这不安全,不应在生产环境中使用。

@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
 registry.addHandler(handler(), "/helloworld").setAllowedOrigins("*");
}

Here's the response from the Kurento team as to why it is coded this way ... https://groups.google.com/d/msg/kurento/Q5ODV7hkuOc/RnsZKBaXDQAJ 以下是Kurento团队对此进行编码的响应... https://groups.google.com/d/msg/kurento/Q5ODV7hkuOc/RnsZKBaXDQAJ

Please ensure that Kurento Media Server is installed and is running. 请确保已安装并正在运行Kurento Media Server。

https://github.com/Kurento/kurento-media-server https://github.com/Kurento/kurento-media-server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 wss上的WebSocket连接失败 - WebSocket connection on wss failed WebSocket连接失败:WebSocket打开握手被取消 - WebSocket connection failed: WebSocket opening handshake was canceled WebSocket与OpenShift应用程序的连接失败 - WebSocket connection to OpenShift app failed WebSocket 连接失败 资源不足 - WebSocket connection failed Insufficient resources 禁止“与'xyz'的WebSocket连接失败” - Suppress “WebSocket connection to 'xyz' failed” CloudMQTT中的MQTT Websocket连接失败 - MQTT Websocket connection failed in CloudMQTT WebSocket 连接失败:连接建立错误 - WebSocket Connection failed: error in connection establishment WebSocket 连接失败。 WebSocket 握手期间出错 - socketjs - WebSocket connection failed. Error during WebSocket handshake - socketjs 与'ws:// ... / websocket'的Meteor WebSocket连接失败:WebSocket握手期间出错:意外的响应代码:400 - Meteor WebSocket connection to 'ws://…/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400 Websocket连接被拒绝。 WebSocket与'ws://127.0.0.1:2000 /'的连接失败:连接建立错误:net :: ERR_CONNECTION_REFUSED - Websocket connection refused. WebSocket connection to 'ws://127.0.0.1:2000/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM