I use socket.io-clientto connect the socket from my own native application to the ssl socket server and receive an error on the connect-error- event [Error: xhr poll error].
Here is my code from the native reaction (client side):
import io from 'socket.io-client';
import Config from '../../config';
var socketConfig = {
secure: true
}
function connect() {
this.socket = io(Config.notificationUrl, socketConfig);
// this.socket.connect();
this.socket.on('connect', () => console.log("Socket connected", self.socket.id));
this.socket.on('connect_error', (err) => console.log("connect_error", err));
this.socket.on('error', (err) => console.log("error", err));
}
I tried to add transports: ['websocket', 'polling'] to socketConfig, but I also had another error [Error: websocket error]. Also tried to use import io from 'socket.io-client/dist/socket.io', but not different.
Note. I am successfully connecting to a socket server using the http protocol.
I am using native 0.40.0 response and socket.io-client 1.7.3.
source
share