1
votes

When running the kurento_hello_world Nodejs tutorial the Kurento Client fails to connect with my Kurento Media Server running on AWS. However, the corresponding Browser Javascript tutorial works fine with the exact same setup.

My setup includes a Kurento Media Server running on an EC2 instance. This was installed using the publicly available CloudFormation config for the server. I have configured the certificates correctly and ensured my browsers trust them.

I have the tutorials installed and running from a separate EC2 instance. I am using version 6.10.0 of the tutorials (however, I experience the same with 6.9.0).

I am testing this using Chrome.

For the Browser JavaScript Hello World tutorial I updated the js/index.js file to include:

var args = getopts(location.search,
{
  default:
  {
    // ws_uri: 'wss://' + location.hostname + ':8433/kurento',
    ws_uri: 'wss://<IP_Of_KMS_On_AWS>:8433/kurento', // Kurento server on AWS
    ice_servers: undefined
  }
});

This results in the tutorial working fine. I see both video stream in the browser and logs in the KMS log file.

For the Node Hello World tutorial I updated the server.js file to include:

var argv = minimist(process.argv.slice(2), {
    default: {
      // as_uri: 'https://localhost:8443/',
      as_uri: 'https://<IP_Of_Application_Server>:8443/', // Application server on EC2
      // ws_uri: 'ws://localhost:8888/kurento'
        ws_uri: 'wss://<IP_Of_KMS_On_AWS>:8433/kurento', // Kurento server on AWS
    }
});

In the Node tutorial, the basic browser elements work fine, however the application fails to make successful connections to the KMS. I don't see anything in the KMS logs. I see the local video displayed in the browser, with a spinner in the remote video element. This is a similar experience I've had with other Node Kurento tutorials, i.e. no calls being made to the KMS instance on AWS.

I am expecting that based on my configuration the Hello World Node tutorial should work the same as the Browser Javascript tutorial and I should see both video streams in the browser and logs being generated on the Kurento server.

Open questions: 1) Does my configuration look correct? 2) Am I missing something in my setup?

1
Hi, Can you please check whether you have configured KMS default port 8888 to 8443 correctly.Buddhika Jayawardhana
@BuddhikaJayawardhana - I believe they are setup correctly. If you notice, my setup works fine when I run the browser Javascript version of the tutorial. Are you saying that the node.js version of the tutorial uses different ports on the KMS?Matt Wenger

1 Answers

0
votes

I faced the same problem today. After setting up the ec2 instance with Kurento i followed the steps laid out in hello-world nodejs tutorial, (changed last step, see why ):

git clone https://github.com/Kurento/kurento-tutorial-node.git
cd kurento-tutorial-node/kurento-hello-world
git checkout 6.13.0
npm install
cd static
bower install --allow-root
cd ..
npm start -- --as_uri=https://0.0.0.0:8081/ npm start -- --ws_uri=ws://0.0.0.0:8888/kurento

I saw the same behaviour in the browser: I could see local stream video being displayed, but not the remote stream, but unlike you I saw this log in my ec2 terminal:

/home/ubuntu/kurento-tutorial-node/kurento-hello-world/node_modules/express-session/index.js:142
    if (req.session) return next();
            ^

TypeError: Cannot read property 'session' of undefined
    at session (/home/ubuntu/kurento-tutorial-node/kurento-hello-world/node_modules/express-session/index.js:142:13)
    at WebSocketServer.<anonymous> (/home/ubuntu/kurento-tutorial-node/kurento-hello-world/server.js:90:5)
    at emitTwo (events.js:126:13)
    at WebSocketServer.emit (events.js:214:7)
    at handleUpgrade (/home/ubuntu/kurento-tutorial-node/kurento-hello-world/node_modules/ws/lib/websocket-server.js:90:18)
    at WebSocketServer.completeUpgrade (/home/ubuntu/kurento-tutorial-node/kurento-hello-world/node_modules/ws/lib/websocket-server.js:329:5)
    at WebSocketServer.handleUpgrade (/home/ubuntu/kurento-tutorial-node/kurento-hello-world/node_modules/ws/lib/websocket-server.js:245:10)
    at Server.upgrade (/home/ubuntu/kurento-tutorial-node/kurento-hello-world/node_modules/ws/lib/websocket-server.js:89:16)
    at emitThree (events.js:136:13)
    at Server.emit (events.js:217:7)

I found this thread that helped me with solving this problem. From the thread:

the problem was that the source was using an old version of ws which since the writing of the code has removed ws.upgradeReq

I checked the GitHub page for the code of server.js and saw that the if (req.session) return next(); part got changed. I removed the /kurento-tutorial-node project from my ec2 and took all the steps from the hello-world nodejs tutorial BUT WITHOUT git checkout 6.13.0 in order to get the new version of the code. So I did:

git clone https://github.com/Kurento/kurento-tutorial-node.git
cd kurento-tutorial-node/kurento-hello-world
npm install
cd static
bower install --allow-root
cd ..
npm start -- --as_uri=https://0.0.0.0:8081/ npm start -- --ws_uri=ws://0.0.0.0:8888/kurento

and this time it worked

enter image description here