Help sharing app on local network

Hi. I’m trying to share my app on my local network and getting stuck. I have openvidu running locally in the docker container like so…

docker run -p 4443:4443 --rm --name openvidu \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOMAIN_OR_PUBLIC_IP=192.168.1.26 \
-e OPENVIDU_SECRET=123 \
openvidu/openvidu-server-kms:2.14.0

I created a cert and key with mkcert and I am able to access my app running at https://192.168.1.26:8001/.

I am able to access the openvidu dashboard running at https://192.168.1.26:4443/dashboard/#/ and I am able to start a test session there.

I am able to make api calls from my app to the openvidu server.

But when I try to join a session from my app at I get…

webSocketWithReconnection.js:14 WebSocket connection to 'wss://192.168.1.26:4443/openvidu' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID

Any idea what I’m doing wrong?

Thanks.

UPDATE: This is only happening in Chrome. It works in Firefox.

Try opening https://192.168.1.26:4443/openvidu in the browser and accepting the certificate. Then go to your app and test it.

I am accepting the cert when going to the dashboard.

I also tried manually adding the cert to Keychain Access in Mac. After that I get a different error… ERR_CERT_COMMON_NAME_INVALID and Subject Alternative Name missing. This seems to be discussed here…

Is that something you can fix in the openvidu cert?

Are you using Docker Desktop for Mac?

If so… why are you using https://192.168.1.26:4443/openvidu instead of https://127.0.0.1:4443/?

Yes I am using Docker for Mac. I am trying to share my app on my local network.

We haven’t tested that scenario.

Maybe you can generate a valid certificate and regenerate docker image with it.

Isn’t this the scenario described in the docs here… https://docs.openvidu.io/en/2.14.0/troubleshooting/#share-your-app-through-your-network-to-test-with-multiple-devices

We have tested with linux and it works. But we never tested on Mac or Windows. Maybe there are some specific details to take into account.

Please share with use if you finally manage to get it working.

Did you test Chrome on Linux? Chrome seems to be the only browser having this problem. Also, does the cert used by openvidu have Subject Alternative Name applied? That might be the solution for Chrome according to the discussion I linked to above.

Yes, Chrome in Linux works fine when sharing openvidu-server-kms docker image over LAN, at least last time I checked. If I remember corretly, I think openvidu-server self-signed certificate was created with a very simple openssl command like this: openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj '//CN=www.mydom.com\O=My Company LTD.\C=US' -keyout key.pem -out cert.pem

Here’s some more info in case it helps track this down.

I was focussed on getting openvidu working so I could test it shared on my local network. But I didn’t realize that using a self-signed cert with https on the local network causes the websockets in my app (not related to openvidu) to fail. My websockets works over http even with the 192 ip). But when I use http and test openvidu, I am able to connect to a session, but then call to publish never resolves. So I have something like this…

console.log('*** _testVideoSession.publish');
_testVideoSession.publish(_testVideoPublisher)
.then(() => {
   console.log('*** publish ok');
})
.catch((error) => {
  console.log('*** publish error');
});

I get nothing after the 1st log. I don’t get publish ok or publish error. This happens even when testing on my dev machine (not just other machines on the network).

Here’s the output from the server when attempting to publish…

2020-06-27 19:12:38,525 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:12:38,524 [0.0-4443-exec-8] io.openvidu.server.rpc.RpcHandler - After connection established for WebSocket session: t0lg18gafvjom695nc42l9hlff

2020-06-27 19:12:38,538 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:12:38,537 [c42l9hlff-e4-t0] io.openvidu.server.core.Session - Token consumed { Session: ses_U26ysCCZQb | Tokens: [wss://192.168.1.26:4443?sessionId=ses_U26ysCCZQb&token=tok_XZBkhCdxeNTy69cQ&role=PUBLISHER&version=2.14.0, wss://192.168.1.26:4443?sessionId=ses_U26ysCCZQb&token=tok_WXxToHPhhVhTT9fE&role=PUBLISHER&version=2.14.0] }

2020-06-27 19:12:38,543 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:12:38,543 [c42l9hlff-e4-t0] io.openvidu.server.core.SessionManager - Participant con_IABidMI6hf of session ses_U26ysCCZQb is a final user connecting to this session for the first time

2020-06-27 19:12:38,549 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:12:38,549 [c42l9hlff-e4-t0] io.openvidu.server.kurento.core.KurentoSessionManager - KMS less loaded is ws://localhost:8888/kurento with a load of 1.0

2020-06-27 19:12:38,552 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:12:38,552 [c42l9hlff-e4-t0] io.openvidu.server.kurento.core.KurentoSessionManager - No session 'ses_U26ysCCZQb' exists yet. Created one on KMS 'kms_VaozABrC' with ip 'localhost'

2020-06-27 19:12:38,560 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:12:38,558 [c42l9hlff-e4-t0] io.openvidu.server.kurento.core.KurentoSession - SESSION ses_U26ysCCZQb: Creating MediaPipeline

2020-06-27 19:12:38,578 DEBG 'kms' stdout output:
0:01:01.302487400     8 0x7fb894001cd0 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:513:processMessage: Message: {"id":9,"method":"create","params":{"type":"MediaPipeline","constructorParams":{},"properties":{},"sessionId":"c1ec2bf1-1363-4db4-a3e6-3c2e194075c6"},"jsonrpc":"2.0"}

2020-06-27 19:12:38,579 DEBG 'kms' stdout output:
0:01:01.303270300     8 0x7fb894001cd0 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:515:processMessage: Response: {"id":9,"jsonrpc":"2.0","result":{"sessionId":"c1ec2bf1-1363-4db4-a3e6-3c2e194075c6","value":"1e2fad59-6fce-4614-b606-811e8edca254_kurento.MediaPipeline"}}

2020-06-27 19:12:38,610 DEBG 'kms' stdout output:
0:01:01.334607300     8 0x7fb8780012f0 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:513:processMessage: Message: {"id":10,"method":"subscribe","params":{"type":"Error","object":"1e2fad59-6fce-4614-b606-811e8edca254_kurento.MediaPipeline","sessionId":"c1ec2bf1-1363-4db4-a3e6-3c2e194075c6"},"jsonrpc":"2.0"}
0:01:01.334853100     8 0x7fb8780012f0 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:515:processMessage: Response: {"id":10,"jsonrpc":"2.0","result":{"sessionId":"c1ec2bf1-1363-4db4-a3e6-3c2e194075c6","value":"6f8b7482-cdc5-4824-a51e-6f76f8814d82"}}

2020-06-27 19:12:38,629 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:12:38,626 [c42l9hlff-e4-t0] io.openvidu.server.kurento.core.KurentoSession - SESSION ses_U26ysCCZQb: Added participant [participantPrivateId=t0lg18gafvjom695nc42l9hlff, participantPublicId=con_IABidMI6hf, streaming=false]

When I run my app in localhost instead of the 192 ip it works. I see the same output as above but then it continues with…

2020-06-27 19:09:58,109 DEBG 'openvidu-server' stdout output:
[INFO] 2020-06-27 19:09:58,107 [9umadf1l-e18-t0] io.openvidu.server.rpc.RpcHandler - Participant con_HPV2fJrdq5 is calling method 'publish' in session ses_B4TEZn70rh

2020-06-27 19:09:58,109 DEBG 'kms' stdout output:
0:17:15.432650500     8 0x7f4cc8001d80 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:513:processMessage: Message: {"id":300,"method":"create","params":{"type":"WebRtcEndpoint","constructorParams":{"mediaPipeline":"c1143201-6321-4a93-8b69-9bd370ed7ad0_kurento.MediaPipeline"},"properties":{},"sessionId":"1ff228b8-7dee-446d-9d75-5f06d333c1dd"},"jsonrpc":"2.0"}

2020-06-27 19:09:58,113 DEBG 'kms' stdout output:
0:17:15.436388400     8 0x7f4cc8001d80 INFO    KurentoBaseRtpEndpointImpl BaseRtpEndpointImpl.cpp:114:BaseRtpEndpointImpl: No predefined RTP MTU found in config; using default
0:17:15.436583200     8 0x7f4cc8001d80 INFO    KurentoWebRtcEndpointImpl WebRtcEndpointImpl.cpp:104:remove_not_supported_codecs_from_array:<kmswebrtcendpoint4> Removing not supported codec 'AMR/8000'
0:17:15.436674900     8 0x7f4cc8001d80 INFO    KurentoWebRtcEndpointImpl WebRtcEndpointImpl.cpp:521:WebRtcEndpointImpl: No predefined external IP address found in config; you can set one or default to STUN automatic discovery
0:17:15.436732500     8 0x7f4cc8001d80 INFO    KurentoWebRtcEndpointImpl WebRtcEndpointImpl.cpp:532:WebRtcEndpointImpl: No predefined network interfaces found in config; you can set one or default to ICE automatic discovery

This is the same in any browser I’ve tried.

Does this help find the issue, since it’s not related to my cert or sharing on the local network. It seems to just be caused by using the 192 ip. Do the logs or the fact that the publish method never resolves help?

Thanks again.

If it is working on Firefox and not in Chrome, it is maybe related with how the browser manages self-signed certificates.

This is happening in both Chrome and Firefox. The issue that was only happening in Chrome was when I was using https.

Update… I found that the call to initPublisher is resulting in an error… TypeError: navigator.mediaDevices is undefined

Any other advice on this? To summarize… when I run my app locally with http://192.168… I get the error above when calling initPublisher and the the call to session.publish never resolves at all.

navigator.mediaDevices is undefined if you are not serving your web app on https

BRowsers eliminate Media Devices API on HTTP. So you can’t access the object: https://docs.openvidu.io/en/2.15.0/troubleshooting/#10-my-local-video-is-not-showing-up-on-the-browser