title: Can´t connect with Socket io to https with React Native
body: <p>I am trying to setup my apps chat with socket.io and use https. It worked when i was using http, but since this was changed because of security i can not connect to my chat server anymore. </p>
  
  <p>Actually there shouldn´t be much to do this, maybe anyone has experienced out similar issue?</p>
  
  <p>Connecting to my Chat Server from my Web-Frontend works great, but trying this code below does not connect for Android as well as for iOS:</p>
  
  <pre><code>import './UserAgent.js';
  import io from 'socket.io-client/socket.io';
  
  const connectionOptions = {
    jsonp     : false,
    transports: ['websocket'],
    secure    : true
  };
  
  export class App extends Component {
  
    constructor() {
      super();
      this.state = {
          chatThings: ''
      };
  
      this.chatUrl = 'https://chat.foo.info';
      this.socket  = io(this.chatUrl, connectionOptions)
    }
  
    connectToChatServer() {
  
      let tries = 0;
      var that  = this;
      setInterval(()=&gt; {
          that.socket.connect(that.chatUrl, connectionOptions);
          console.log('CHAT url', that.chatUrl);
          if (that.socket.connected) {
              alert('Finally CONNECTED!!!!!!');
              that.setState({
                  connected: socket.connected
              });
  
          }
          tries = tries + 1;
      }, 2500);
  
      this.socket.on('error', (err)=&gt; {
          console.log('CHAT: error', err);
      });
  }
  </code></pre>
  
  <p>Using latest ReactNative and latest socket.io</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>window.navigator.userAgent = 'ReactNative';
  
  var io = require('../node_modules/socket.io-client/dist/socket.io');
  
  // -----------------------------------------------------------------------------------------------------------------
  // Chat
  // -----------------------------------------------------------------------------------------------------------------
  
  Backend.prototype.connectToChatServer = function () {
    let self = this;
    this.dispatch(Actions.connectToChatServer());
  
    const connectionOptions = {
      jsonp     : false,
      secure    : true,
      transports: ['websocket']
    };
  
    log.info('CHAT IO CONNECTION');
    this.socket = io(this.chatUrl, connectionOptions);
    function authenticate() {
      self.socket.emit('authenticate', {token: Store.getState().User.token});
    }
  
  ........
  </code></pre>
  
  <p><strong>Actually the only thing i have changed is updating socket io and react native to the latest and using UserAgent from ReactNative. I hope this help anyone</strong></p>
  
  <pre><code>"socket.io-client": "^1.7.1",
  "react-native": "^0.29.2", // this version worked, i have tested it on RN 43 too which works as well
  </code></pre>