title: Rails ActionCable and React Native
body: <p>I'm working on a companion React Native app to accompany my RoR webapp, and want to build a chat feature using ActionCable (websockets). I cannot get my React Native app to talk to ActionCable.</p>
  
  <p>I have tried a number of libraries including <a href="https://github.com/cpunion/react-native-actioncable" rel="nofollow noreferrer">react-native-actioncable</a> with no luck. The initial connection seems to be working (I know this because I was having errors before and they've since gone away when I passed the proper params).</p>
  
  <p>This is an abbreviated version of my React Native code:</p>
  
  <pre><code>import ActionCable from 'react-native-actioncable'
  
  class Secured extends Component {
    componentWillMount () {
      var url = 'https://x.herokuapp.com/cable/?authToken=' + this.props.token + '&amp;client=' + this.props.client + '&amp;uid=' + this.props.uid + '&amp;expiry=' + this.props.expiry
      const cable = ActionCable.createConsumer(url)
  
      cable.subscriptions.create('inbox_channel_1', {
        received: function (data) {
          console.log(data)
        }
      })
    }
  
    render () {
      return (
        &lt;View style={styles.container}&gt;
          &lt;TabBarNavigation/&gt;
        &lt;/View&gt;
      )
    }
  }
  
  const mapStateToProps = (state) =&gt; {
    return {
      email: state.auth.email,
      org_id: state.auth.org_id,
      token: state.auth.token,
      client: state.auth.client,
      uid: state.auth.uid,
      expiry: state.auth.expiry
    }
  }
  
  export default connect(mapStateToProps, { })(Secured)
  </code></pre>
  
  <p>Anyone with more experience connecting ActionCable to React Native and can help me out?</p>