Duplicate connection socket.io

I have a problem with socket.io client in ionic. iam using it in a cordova android . Sometimes it duplicates the connection or at least I interpret it, and when ocurrs the connection status (pending) appears I can not logging in to the application.

This error happens sometimes. If that does not appear pending status , the application allows me to log correctly.

After a minute I get the pending connection as an error 400 bad request and there if I can login correctly in the application.

(function () {

    .service('SocketService', ['socketFactory', SocketService]);

function SocketService(socketFactory) {

    console.log("conectando con el server");
    return socketFactory({

        ioSocket: io.connect('', {'transports': ['websocket']})
        //ioSocket: io.connect('', {'transports': ['websocket']})