2016-05-17 13 views
-1

Ich versuche, HTTPS-Socket in Android-Anwendung mit socket.io-client-java Bibliothek verbinden, aber ich weiß nicht, wie HTTPS-Socket Coonect.So verbinden Sie HTTPS-Socket in Android

+1

Sie in https://github.com/socketio/socket.io-client-java ** Verbrauch ** Abschnitt überprüfen Hat? Es gibt Beispiele für _SSL (HTTPS, WSS) settings_. –

+0

Ich hatte das gleiche Problem. Überprüfen Sie die Antwort auf [Android Socket.io Websocket-Transport funktioniert nicht in SSL] (http://stackoverflow.com/a/37311623/1306419). Ich hoffe es hilft. –

Antwort

1

Vom Socket.IO Java documentation:

// default settings for all sockets 
IO.setDefaultSSLContext(mySSLContext); 
IO.setDefaultHostnameVerifier(myHostnameVerifier); 

// set as an option 
opts = new IO.Options(); 
opts.sslContext = mySSLContext; 
opts.hostnameVerifier = myHostnameVerifier; 
socket = IO.socket("https://localhost", opts); 
Verwandte Themen