Hey,I am trying to connect using wss ( secure connection ) . I have a .pem file which is in use by domain.com and i am using the same .pem file for kurento secure connection ( wss://domain.com:8433/kurento ). Is this correct approach ? If its wrong then please guide me the correct way. and please give a short example of configuring wss. I am not able to find any example for wss. Thanks in advance for your answer.
--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Java: Changing this line in HelloWorldApp.java:
final static String DEFAULT_KMS_WS_URI = "wss://localhost:8433/kurento";
public KurentoClient kurentoClient() {
return KurentoClient.create(System.getProperty("kms.ws.uri",
DEFAULT_KMS_WS_URI));
}
there's no SslContectFactory passed.
In KurentoClient.java has no " import org.eclipse.jetty.util.ssl.SslContextFactory;"
Notice that we passed a unique parameter to KurentoClient.create above.
Having :
public static KurentoClient create(String websocketUrl,
KurentoConnectionListener listener, Properties properties) {
log.info("Connecting to KMS in {}", websocketUrl);
JsonRpcClientWebSocket client = new JsonRpcClientWebSocket(websocketUrl,
JsonRpcConnectionListenerKurento.create(listener));
client.setConcurrentServerRequest(true);
client.setLabel("KurentoClient");
return new KurentoClient(client);
}here JsonRpcClientWebSocket is invoqued with two params : websocketUrl and a listener, according JsonRpcClientWebSocket.java, with two paramas we will be using :public JsonRpcClientWebSocket(String url, JsonRpcWSConnectionListener connectionListener) {
this(url, connectionListener, null);
}so sslContextFactory will be null, and will result on Caused by: java.io.IOException: Cannot init SSL
what do you think ?How to make it work with wss with minimal change ?FYI : this is KMS conf (it works like a charm and no error in the log)..."websocket": {"port": 8888,"secure": {"port": 8443,"certificate": "path/to/cert.pem","password": ""},//"registrar": {// "address": "ws://localhost:9090",// "localAddress": "localhost"//},"path": "kurento","threads": 10}
Yes , I imported the certificate in my cacert of the JRE, besides, it's delivered by a trusted CA.
If you are using a self-signed certificate, you should do something like this
SslContextFactory sec = new SslContextFactory(true);
sec.setValidateCerts(false);
JsonRpcClientWebSocket client = new JsonRpcClientWebSocket(uri, sec);
Sorry, we should add that to the documentation, you are right. Thanks for spotting that!
Cheers,
--
SslContextFactory sec = new SslContextFactory(true); sec.setValidateCerts(false); JsonRpcClientWebSocket client = new JsonRpcClientWebSocket(uri, sec);
Can I use this code in One2oneCallAdvApp.java ? or do I need to patch kurentoClient.java or JsonRpcClientWebSocket.java ?Regards
That’s to be used when you instantiate the KurentoClient.
SslContextFactory sec = new SslContextFactory(true);
sec.setValidateCerts(false);
JsonRpcClientWebSocket rpcClient = new JsonRpcClientWebSocket(uri, sec);
KurentoClient kuretoClient = KurentoClient.createFromJsonRpcClient(rpcClient);
Kurento client uses internally a JSON-RPC protocol. The JsonRpcClient
is used to send the requests to KMS (or another JSON RPC server), and this can be done through different transports. WS is just one of them, and if it is required to use secure connections, it is needed to create the client outside of the KurentoClient
.
I’ll add this to the docs.
--
log.info("Connecting to kms in {}", websocketUrl);
++ SslContextFactory sec = new SslContextFactory(true);
++ sec.setValidateCerts(false);
JsonRpcClientWebSocket client = new JsonRpcClientWebSocket(websocketUrl,sec);
client.setLabel("KurentoClient");
return new KurentoClient(client);
}
@Bean
public KurentoClient kurentoClient() {
SslContextFactory sec = new SslContextFactory(true);
sec.setValidateCerts(false);
String uri = System.getProperty("kms.ws.uri", DEFAULT_KMS_WS_URI);
JsonRpcClientWebSocket client = new JsonRpcClientWebSocket(uri, sec);
return KurentoClient.createFromJsonRpcClient(rpcClient);
}