Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to connect react native app to live URL server using socket.io for Chat application?

$
0
0

Here is the code implemented for socket connection but it did not working. I want to create chat messaging app in react native with realtime updates which uses backend of our web side server. I am trying to connect my app to socket io but its not working.

I have used socket.IO-client for react native:

import SocketIOClient from 'socket.IO-client'

export default Class Socket extends Component{
  constructor(){
    super();
    var Live_URL = "https://xxx.xxxxxxx.xxx/"
    this.socket = SocketIOClient(Live_URL);
  }

  componentDidMount(){
    this.socket.connect();
    this.socket.on("connect", () => {
      console.log('connection.')
    });
  }
}

Please, any solution?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>