Connect TLS to the connector through Nodejs

I am trying to establish a TLS socket connection to chat.facebook.com: 5222 port through Nodejs. Im using the following code:

 var a=require('tls');
 var b=a.connect(5222,'chat.facebook.com',function(){console.log("connected");});
 b.on('error',function(error){console.log(error);})

But it does not connect and instead gives an error:

 [Error: 140089045411648:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown    protocol:../deps/openssl/openssl/ssl/s23_clnt.c:683:]

I tried a similar connection with encrypted.google.com:443, and the console readily ran "connected".

Can someone direct me to what I am missing, or what can be done to overcome this problem.

+5
source share
1 answer

xmpp with tls uses "STARTTLS", updating the protocol from plaintext to encrypted. See http://xmpp.org/rfcs/rfc6120.html#tls for more details .

( , xml , , TLS)

0

All Articles