Websocket wss failed

hello,
I’ve compiled and installed an openvidu server and classroom-demo in Ubuntu 20.04.
but the classroom-demo browser can’t see the video , and reports error in console:

WebSocket connection to 'wss://18.183.92.166:4443/openvidu?sessionId=ses_NtupFDW3OG' failed: main.js 1 

I tested curl in another mac, it seems ok.
so what’s the problem?

logs:

zhh@/Users/zhh $ curl -k --no-buffer -H 'Connection: keep-alive, Upgrade' -H 'Upgrade: websocket' -v -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: websocket'  https://18.183.92.166:4443/openvidu\?sessionId\=ses_NtupFDW3OG ws | od -t c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 18.183.92.166...
* TCP_NODELAY set
* Connected to 18.183.92.166 (18.183.92.166) port 4443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /Users/zhh/anaconda3/ssl/cacert.pem
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [81 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [913 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=ES; ST=Some-State; O=OpenVidu; emailAddress=openvidu@gmail.com
*  start date: May 30 15:24:17 2017 GMT
*  expire date: May 28 15:24:17 2027 GMT
*  issuer: C=ES; ST=Some-State; O=OpenVidu; emailAddress=openvidu@gmail.com
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
} [5 bytes data]
> GET /openvidu?sessionId=ses_NtupFDW3OG HTTP/1.1
> Host: 18.183.92.166:4443
> User-Agent: curl/7.61.0
> Accept: */*
> Connection: keep-alive, Upgrade
> Upgrade: websocket
> Sec-WebSocket-Version: 13
> Sec-WebSocket-Key: websocket
>
{ [5 bytes data]
< HTTP/1.1 101
< Vary: Origin
< Vary: Access-Control-Request-Method
< Vary: Access-Control-Request-Headers
< Set-Cookie: OVJSESSIONID=FDC43529EAEDBCF6D747E33F569A6C6D; Path=/; Secure; HttpOnly
< Upgrade: websocket
< Connection: upgrade, keep-alive
< Sec-WebSocket-Accept: qVby4apnn2tTYtB1nPPVYUn68gY=
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< Strict-Transport-Security: max-age=31536000 ; includeSubDomains
< X-Frame-Options: DENY
< Date: Mon, 18 Oct 2021 00:18:01 GMT
< Keep-Alive: timeout=60

Is your classroom-demo running through https at the same ip 18.183.92.166 ?

yes, through https. but with deferent port and the port is 5000.
and the openvidu port is 4443.

Please, can you describe how did you deploy OpenVidu, and how are you deploying the classroom-demo?

I run compile openvidu and classroom-demo source and configue application.properties.
then run command:

 mvn exec:java

My kurento will shut down the video about 150seconds, also a problem.

I deloyed a docker kurento with independented coturn.

and I run the tutorial HelloWorldApp.

But the video will broken automatically about 150seconds.

What’s the probably problem?

when the remote video is automatically stopped, I click Stop, chrome console will display:

“[sendMessage] Skip, WebSocket session isn’t open”

this is the logs of HelloWorldApp. thank you all!


2021-10-15 02:30:50.955 INFO 551016 --- [ventExec-e2-t30] org.kurento.tutorial.helloworld.Handler : [WebRtcEndpoint::MediaFlowInStateChange] source: user33d6112e-4606-26f0-31ea-251b67328709_webrtcendpoint, timestamp: 1634265050, tags: [], state: FLOWING, padName: default, mediaType: VIDEO

2021-10-15 02:30:51.082 INFO 551016 --- [ventExec-e2-t30] org.kurento.tutorial.helloworld.Handler : [WebRtcEndpoint::MediaStateChanged] source: user33d6112e-4606-26f0-31ea-251b67328709_webrtcendpoint, timestamp: 1634265051, tags: [], oldState: DISCONNECTED, newState: CONNECTED

2021-10-15 02:33:17.594 ERROR 551016 --- [nio-8443-exec-8] org.kurento.tutorial.helloworld.Handler : [Handler::handleTransportError] Exception: java.io.EOFException, sessionId: 33d6112e-4606-26f0-31ea-251b67328709

2021-10-15 02:33:17.595 WARN 551016 --- [nio-8443-exec-8] org.kurento.tutorial.helloworld.Handler : [Handler::afterConnectionClosed] status: CloseStatus[code=1011, reason=null], sessionId: 33d6112e-4606-26f0-31ea-251b67328709

2021-10-15 02:33:17.595 INFO 551016 --- [nio-8443-exec-8] org.kurento.tutorial.helloworld.Handler : [Handler::stop] Release the Media Pipeline

https://mydomain.com:4443/dashboard/#/
Error connecting to session: [0] Http failure response for https://18.183.92.166:4443/openvidu/api/sessions: 0 Unknown Error
in chrome console,it reports error:

Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID

But if I using the IP to connect will be ok.
https://18.183.92.166:4443/dashboard/#/

what’s the problem?

Are you deploying in a VPS, or you’re just trying OpenVidu in your LAN network?

If you’re using openvidu-server-kms docker image, this image is used only for local development

If you’re in a VPS and you want to deploy there OpenVidu with openvidu-classroom, please follow this deployment instructions first:

Secondly, you can create your own image with your code following this:

If you don’t want to create any docker image, you just need to run the classroom-demo at port 5442.

With the official deployment you will be able to access your app through https://DOMAIN_OR_PUBLIC_IP/ (our nginx proxy will reverse proxy from 5442 to 443) and openvidu request will go through https://DOMAIN_OR_PUBLIC_IP/openvidu (our nginx proxy will reverse proxy from 5443 to 443).