Kurento / bugtracker

[ARCHIVED] Contents migrated to monorepo: https://github.com/Kurento/kurento
46 stars 10 forks source link

Can't connect kurento-client-js in node app with KMS exposing WSS with self-signed certificate #67

Closed Sanoend closed 5 years ago

Sanoend commented 8 years ago

Hi. Not working kurento-tutorial-node examples.

for example: kurento-one2many-call crashed: /kurento-tutorial-node-master/kurento-one2many-call/server.js:266 presenter.pipeline.create('WebRtcEndpoint', function(error, webRtcEndpoint) { ^ TypeError: Cannot call method 'create' of null at startViewer (/home/sano/kurento-tutorial-node-master/kurento-one2many-call/server.js:266:21) at WebSocket. (/home/sano/kurento-tutorial-node-master/kurento-one2many-call/server.js:111:4) at WebSocket.emit (events.js:98:17) at Receiver.ontext (/home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/WebSocket.js:797:10) at /home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/Receiver.js:473:18 at /home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/Receiver.js:357:7 at /home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/PerMessageDeflate.js:217:5 at afterWrite (_stream_writable.js:278:3) at onwrite (_stream_writable.js:270:7) at WritableState.onwrite (_stream_writable.js:97:5)

This happens because pipline. Pipline not kreate because bad using kurentoKlient:kurento(argv.ws_uri, function(error, _kurentoClient) { ..... two input paramentr and calback return.

While a code module constructor KurentoClient(ws_uri, options, callback) have 3 input parametr and return not calback:

return new KurentoClient(ws_uri, options, callback);

etc ....

And such problems in all examples, functions in a large quantity, and methods, examples of non-working. Explain what am I wrong? Why is it still does not work?

igracia commented 8 years ago

You need to enable WSS in your KMS server. Please check this guide for doing that.

Sanoend commented 8 years ago

igracia WSS ON SSL certificate is authorized. I wrote an application for RTSP2WebRTC and it works. But transcoding (h264 - vp8) creates a new session for each client is connected. I want to make one session for this and try to run the sample one2many-callas but the example does not work. Have you tried to run it yourself?

igracia commented 8 years ago

Yes, I just did. You need to accept the certificate in your browser. From the docs

Browser applications: You’ll need to manually accept the certificate as trusted one before secure WebSocket connections can be established. By default, this can be done by connecting to connecting to https://kms-ip:8433/kurento and accepting the certificate in the browser.

Be careful with the port! It's 8433, not the regular https port.

Sanoend commented 8 years ago

igracia i use certificate is authorized. The browser receives the certificate. In your browser, all things are good, it does not work on the server-side script in this example node.js

node js crashed: /kurento-tutorial-node-master/kurento-one2many-call/server.js:266 presenter.pipeline.create('WebRtcEndpoint', function(error, webRtcEndpoint) { ^ TypeError: Cannot call method 'create' of null at startViewer (/home/sano/kurento-tutorial-node-master/kurento-one2many-call/server.js:266:21) at WebSocket. (/home/sano/kurento-tutorial-node-master/kurento-one2many-call/server.js:111:4) at WebSocket.emit (events.js:98:17) at Receiver.ontext (/home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/WebSocket.js:797:10) at /home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/Receiver.js:473:18 at /home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/Receiver.js:357:7 at /home/sano/kurento-tutorial-node-master/kurento-one2many-call/node_modules/ws/lib/PerMessageDeflate.js:217:5 at afterWrite (_stream_writable.js:278:3) at onwrite (_stream_writable.js:270:7) at WritableState.onwrite (_stream_writable.js:97:5)

jahKIper commented 8 years ago

function getKurentoClient(callback) don't creates kurentoClient

But I created it like this and return it: someHZ = kurento(argv.ws_uri, function(error, _kurentoClient) {...} if (kurentoClient === null) { someHZ.domain = argv.ws_uri; kurentoClient = someHZ; callback(null, kurentoClient); }

now kurentoClient exists { domain: 'wss://localhost:433/kurento', _events: { disconnect: [Function] }, _maxListeners: 10, beginTransaction: [Function], endTransaction: [Function], transaction: [Function], getMediaobjectById: [Function], create: [Function], close: [Function], then: [Function], catch: [Function] }

but it don't creates MediaPipeline ...

igracia commented 8 years ago

Apologies, I thought you were using the browser tutorials. The node tutorials are also working out of the box, with a regular KMS listening in ws://:8888/kurento. You just need to run the server with the url where the KMS can be found npm start -- --ws_uri=ws://<kms-ip>:8433/kurento.

Now, I'm not really sure what you have tried already, or what is it you want to achieve. It it's running the tutorials with a fresh and unmodified instance of KMS, that's the way to go. Or is it that you want your node app to connect with a WSS port in KMS?

jahKIper commented 8 years ago

We want that KMS works with WSS

igracia commented 8 years ago

Ok, that is a bit more clear now. I'm afraid there is some issue with the reconnect-ws library version we are using, and the use of self-signed certificates. We haven't been able to solve this yet, and we are not putting much effort in it right now. Can't tell you when it will be solved.

In the meantime, I'd suggest you use KMS with plain WS. Since both servers are probably going to be deployed in your infrastructure, it's probably not needed. This doesn't make it up for the fact that we need to solve the issue, of course.

tomhouman commented 8 years ago

I am using self-signed certs and have achieved full mutual authentication from client to server, using stunnel in front of KMS. This required the ability to pass in socket options to the client upon creation. My pull request should resolve this issue: https://github.com/Kurento/kurento-client-js/pull/2.

Qsstechnosoft commented 8 years ago

Hi @igracia , I am new to the kurento. Really awesome work!! I succeeded in getting the group call done for various platforms except iOS device. On iPhone I opened the URL say https://172.31.98.207:8443, it prompt with the error "Connection Error. Please reload page." and a black screen for camera view. I don't get why this is happening. Also, if you get a workaround for implementing the kurento in iOS native application with secure services enabled on kms as when I tried to start the room demo for secure port 8433(wss://172.31.98.207:8433). It is piling a lot of errors. FYI: Working locally on Ubuntu 14.04(trusty), KMS - 6.0 Thanks in advance and really great work!!

igracia commented 8 years ago

@Qsstechnosoft Safary does not have WebRTC support, you'll need to create a native app.

For questions, please use the public list.

Qsstechnosoft commented 8 years ago

Yes that's true, however I tried in google chrome in iOS. Do you want to say that none of the browsers chrome, firefox which normally support webRTC don't work on any iOS device. The only work around is to create a native app?

igracia commented 8 years ago

Yes, that's correct. You can try Bowser, maybe.

In any case, a simple search would have told you that ;-)

connectometeam commented 6 years ago

Hello @igracia , the link you posted for enabling wss on KMS is not working. Is there a new one in the documentation? Thanks

ruddell commented 6 years ago

@connectometeam That page of the docs is now located here: https://doc-kurento.readthedocs.io/en/6.7.1/features/security.html#configure-kurento-media-server-to-use-secure-websocket-wss

dsudzy commented 6 years ago

at one point or another I was able to get one2many working but now when I navigate to https://:8433/kurento I always get HTTP ERROR 426 upgrade required I feel like this is the reason it no longer works because I cant accept the self signed cert. Any ideas why this is or how to upgrade the http connection?

ruddell commented 6 years ago

@dsudzy The 426 Upgrade Required code means you need to use WebSockets to connect instead of HTTP, Kurento doesn't have an HTTP interface. You also have the option of using a real certificate (such as a free LetsEncrypt certificate) so you don't have to deal with any self-signed issues.

dsudzy commented 6 years ago

@ruddell Thanks! I've been under the impression this whole time that I was using the websocket connection but some part of my configuration must have gotten messed up along the way. I appreciate the help

j1elo commented 5 years ago

https://github.com/Kurento/kurento-client-js/pull/2 was just merged, possibly fixing this issue

soufiane-fadil commented 4 years ago

Hi,

I guess issue shouldn't be closes!

I still have the same issue, tested on a fresh clone, launched on lastest Chrome and Firefox versions on Ubuntu desktop 18.

issue:

/home/soufiane/kurento-tutorial-node/kurento-one2many-call/server.js:282 presenter.pipeline.create('WebRtcEndpoint', function (error, webRtcEndpoint) { ^

TypeError: Cannot read property 'create' of null at startViewer (/home/soufiane/kurento-tutorial-node/kurento-one2many-call/server.js:282:21)

What im doing wrong?

njavilas2015 commented 3 years ago

Ejecutar el comando npm start -- --ws_uri=ws://{server}:8888/kurento

lianglee commented 1 year ago

pipeline is not working :) in WSS version.