<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abdul Haseeb on Medium]]></title>
        <description><![CDATA[Stories by Abdul Haseeb on Medium]]></description>
        <link>https://medium.com/@hazeeb.me?source=rss-27ba92a24633------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_uNK9kR8kz-Z9iZN.</url>
            <title>Stories by Abdul Haseeb on Medium</title>
            <link>https://medium.com/@hazeeb.me?source=rss-27ba92a24633------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:59:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hazeeb.me/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Use socket.io with react native — Nov 2017]]></title>
            <link>https://medium.com/@hazeeb.me/use-socket-io-with-react-native-nov-2017-a115e346615a?source=rss-27ba92a24633------2</link>
            <guid isPermaLink="false">https://medium.com/p/a115e346615a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[socketio]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Abdul Haseeb]]></dc:creator>
            <pubDate>Sun, 19 Nov 2017 08:25:00 GMT</pubDate>
            <atom:updated>2017-11-19T08:55:18.737Z</atom:updated>
            <content:encoded><![CDATA[<p>I’d gone through many stack over flow questions regarding how to connect <a href="https://socket.io/">socket.io</a> library with <a href="https://facebook.github.io/react-native/">react native</a>. Most of them are using some sort of complex method to get connect with sockets.</p><p>From some of the latest stack over flow questions, navigator.userAgent object is changed into react-native and then importing library, but this is very old and good method. I honestly couldn’t find a good article to connect socket.io with react-native.</p><p>The point of this article isn’t explain developing any react-native app with socket.io, but to demonstrate how to emit and listens to sockets in RN.</p><p>If you didn’t installed client side socket.io package on your RN app, you can easily done by running following command.</p><pre>npm install --save socket.io-client</pre><p>Now, go back to your app and import SocketIOClient</p><pre>import SocketIOClient from ‘socket.io-client&#39;</pre><p>In your constructor, create an instance which will connect with your backend.</p><pre>this.socket = SocketIOClient(&#39;http://localhost:80000&#39;);</pre><p>Now, you’re automatically connected with your server. And you can start emitting to server &amp; listens to data from server.</p><p>In the following example, Constructor will create an instance to socket of type SocketIOClient , and automatically connects with your server. When your app loads, socket emits a message ‘Hi server’ to your server through ‘channel1’.<br>When a user hit on ‘Click’ button, socket.io will emit an object to your server.</p><p>RN Code</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad45758cc91f063503e6037425855d2f/href">https://medium.com/media/ad45758cc91f063503e6037425855d2f/href</a></iframe><p>Server Side:</p><p>Don’t forget to install dependencies and socket.io server library.</p><pre>npm install --save socket.io</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67cfd0fc3b1d8571ad60f4794fa29e1e/href">https://medium.com/media/67cfd0fc3b1d8571ad60f4794fa29e1e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a115e346615a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>