How to implement publish / subscribe feature with a server in react native





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I'm trying to build a chat applicaton in react native using redis pub/sub. Searched

redis client for javascript but i didn't get. Can anyone let me know how to use redis pub/sub in react native.










share|improve this question































    1















    I'm trying to build a chat applicaton in react native using redis pub/sub. Searched

    redis client for javascript but i didn't get. Can anyone let me know how to use redis pub/sub in react native.










    share|improve this question



























      1












      1








      1








      I'm trying to build a chat applicaton in react native using redis pub/sub. Searched

      redis client for javascript but i didn't get. Can anyone let me know how to use redis pub/sub in react native.










      share|improve this question
















      I'm trying to build a chat applicaton in react native using redis pub/sub. Searched

      redis client for javascript but i didn't get. Can anyone let me know how to use redis pub/sub in react native.







      javascript web-services react-native publish-subscribe






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 29 '18 at 11:43









      Julien Kode

      1,798620




      1,798620










      asked Nov 29 '18 at 5:29









      Tejas Tejas

      256




      256
























          2 Answers
          2






          active

          oldest

          votes


















          1














          You have to implement redis on the backend side, not on the frontend.
          Redis is a database as they say on their websites here




          Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker




          For the frontend side if you want to use publish / subscribe feature you can use websockets for example.



          Here is some good libraries to use with React Native:




          • Socket.io

          • React native also bring support for WebSockets


          On the backend side you can use:




          • Socket.io

          • ws

          • sockjs

          • socketcluster


          Here is an example using the React Native WebSockets:



          var ws = new WebSocket('wss://example.com/stuff');

          ws.onopen = () => {
          // connection opened
          ws.send('Hello world'); // send a message
          };

          ws.onmessage = (e) => {
          // a message was received
          console.log(e.data);
          };


          You also have other alternatives, like long-pooling






          share|improve this answer


























          • Thank you. Socket.io library works. But socket.io channel disconnects whenever the app is in background or closed, how to keep channel connected all time because i have to include push notification feature to my chat application.

            – Tejas
            Nov 29 '18 at 11:34











          • You have a react native or react.js app ?

            – Julien Kode
            Nov 29 '18 at 11:35











          • React native application

            – Tejas
            Nov 29 '18 at 11:39











          • Okay i'll raise a question regarding this.

            – Tejas
            Nov 29 '18 at 11:46



















          2














          Redis is a database and is often used in backend solutions.
          As I understand you are trying to implement a client-side solution in React Native.



          To make it simpler you can use a ready backend and SDK compatible with React Native to build your app.



          For example, ConnectyCube has added React Native support to its JavaScript SDK. It has a lot of features useful for building chat applications for various purposes.



          Check their documentation how you can build it.



          Here is a useful guide how to build an XMPP chat in React Native.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53532428%2fhow-to-implement-publish-subscribe-feature-with-a-server-in-react-native%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You have to implement redis on the backend side, not on the frontend.
            Redis is a database as they say on their websites here




            Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker




            For the frontend side if you want to use publish / subscribe feature you can use websockets for example.



            Here is some good libraries to use with React Native:




            • Socket.io

            • React native also bring support for WebSockets


            On the backend side you can use:




            • Socket.io

            • ws

            • sockjs

            • socketcluster


            Here is an example using the React Native WebSockets:



            var ws = new WebSocket('wss://example.com/stuff');

            ws.onopen = () => {
            // connection opened
            ws.send('Hello world'); // send a message
            };

            ws.onmessage = (e) => {
            // a message was received
            console.log(e.data);
            };


            You also have other alternatives, like long-pooling






            share|improve this answer


























            • Thank you. Socket.io library works. But socket.io channel disconnects whenever the app is in background or closed, how to keep channel connected all time because i have to include push notification feature to my chat application.

              – Tejas
              Nov 29 '18 at 11:34











            • You have a react native or react.js app ?

              – Julien Kode
              Nov 29 '18 at 11:35











            • React native application

              – Tejas
              Nov 29 '18 at 11:39











            • Okay i'll raise a question regarding this.

              – Tejas
              Nov 29 '18 at 11:46
















            1














            You have to implement redis on the backend side, not on the frontend.
            Redis is a database as they say on their websites here




            Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker




            For the frontend side if you want to use publish / subscribe feature you can use websockets for example.



            Here is some good libraries to use with React Native:




            • Socket.io

            • React native also bring support for WebSockets


            On the backend side you can use:




            • Socket.io

            • ws

            • sockjs

            • socketcluster


            Here is an example using the React Native WebSockets:



            var ws = new WebSocket('wss://example.com/stuff');

            ws.onopen = () => {
            // connection opened
            ws.send('Hello world'); // send a message
            };

            ws.onmessage = (e) => {
            // a message was received
            console.log(e.data);
            };


            You also have other alternatives, like long-pooling






            share|improve this answer


























            • Thank you. Socket.io library works. But socket.io channel disconnects whenever the app is in background or closed, how to keep channel connected all time because i have to include push notification feature to my chat application.

              – Tejas
              Nov 29 '18 at 11:34











            • You have a react native or react.js app ?

              – Julien Kode
              Nov 29 '18 at 11:35











            • React native application

              – Tejas
              Nov 29 '18 at 11:39











            • Okay i'll raise a question regarding this.

              – Tejas
              Nov 29 '18 at 11:46














            1












            1








            1







            You have to implement redis on the backend side, not on the frontend.
            Redis is a database as they say on their websites here




            Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker




            For the frontend side if you want to use publish / subscribe feature you can use websockets for example.



            Here is some good libraries to use with React Native:




            • Socket.io

            • React native also bring support for WebSockets


            On the backend side you can use:




            • Socket.io

            • ws

            • sockjs

            • socketcluster


            Here is an example using the React Native WebSockets:



            var ws = new WebSocket('wss://example.com/stuff');

            ws.onopen = () => {
            // connection opened
            ws.send('Hello world'); // send a message
            };

            ws.onmessage = (e) => {
            // a message was received
            console.log(e.data);
            };


            You also have other alternatives, like long-pooling






            share|improve this answer















            You have to implement redis on the backend side, not on the frontend.
            Redis is a database as they say on their websites here




            Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker




            For the frontend side if you want to use publish / subscribe feature you can use websockets for example.



            Here is some good libraries to use with React Native:




            • Socket.io

            • React native also bring support for WebSockets


            On the backend side you can use:




            • Socket.io

            • ws

            • sockjs

            • socketcluster


            Here is an example using the React Native WebSockets:



            var ws = new WebSocket('wss://example.com/stuff');

            ws.onopen = () => {
            // connection opened
            ws.send('Hello world'); // send a message
            };

            ws.onmessage = (e) => {
            // a message was received
            console.log(e.data);
            };


            You also have other alternatives, like long-pooling







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 29 '18 at 7:29

























            answered Nov 29 '18 at 7:17









            Julien KodeJulien Kode

            1,798620




            1,798620













            • Thank you. Socket.io library works. But socket.io channel disconnects whenever the app is in background or closed, how to keep channel connected all time because i have to include push notification feature to my chat application.

              – Tejas
              Nov 29 '18 at 11:34











            • You have a react native or react.js app ?

              – Julien Kode
              Nov 29 '18 at 11:35











            • React native application

              – Tejas
              Nov 29 '18 at 11:39











            • Okay i'll raise a question regarding this.

              – Tejas
              Nov 29 '18 at 11:46



















            • Thank you. Socket.io library works. But socket.io channel disconnects whenever the app is in background or closed, how to keep channel connected all time because i have to include push notification feature to my chat application.

              – Tejas
              Nov 29 '18 at 11:34











            • You have a react native or react.js app ?

              – Julien Kode
              Nov 29 '18 at 11:35











            • React native application

              – Tejas
              Nov 29 '18 at 11:39











            • Okay i'll raise a question regarding this.

              – Tejas
              Nov 29 '18 at 11:46

















            Thank you. Socket.io library works. But socket.io channel disconnects whenever the app is in background or closed, how to keep channel connected all time because i have to include push notification feature to my chat application.

            – Tejas
            Nov 29 '18 at 11:34





            Thank you. Socket.io library works. But socket.io channel disconnects whenever the app is in background or closed, how to keep channel connected all time because i have to include push notification feature to my chat application.

            – Tejas
            Nov 29 '18 at 11:34













            You have a react native or react.js app ?

            – Julien Kode
            Nov 29 '18 at 11:35





            You have a react native or react.js app ?

            – Julien Kode
            Nov 29 '18 at 11:35













            React native application

            – Tejas
            Nov 29 '18 at 11:39





            React native application

            – Tejas
            Nov 29 '18 at 11:39













            Okay i'll raise a question regarding this.

            – Tejas
            Nov 29 '18 at 11:46





            Okay i'll raise a question regarding this.

            – Tejas
            Nov 29 '18 at 11:46













            2














            Redis is a database and is often used in backend solutions.
            As I understand you are trying to implement a client-side solution in React Native.



            To make it simpler you can use a ready backend and SDK compatible with React Native to build your app.



            For example, ConnectyCube has added React Native support to its JavaScript SDK. It has a lot of features useful for building chat applications for various purposes.



            Check their documentation how you can build it.



            Here is a useful guide how to build an XMPP chat in React Native.






            share|improve this answer




























              2














              Redis is a database and is often used in backend solutions.
              As I understand you are trying to implement a client-side solution in React Native.



              To make it simpler you can use a ready backend and SDK compatible with React Native to build your app.



              For example, ConnectyCube has added React Native support to its JavaScript SDK. It has a lot of features useful for building chat applications for various purposes.



              Check their documentation how you can build it.



              Here is a useful guide how to build an XMPP chat in React Native.






              share|improve this answer


























                2












                2








                2







                Redis is a database and is often used in backend solutions.
                As I understand you are trying to implement a client-side solution in React Native.



                To make it simpler you can use a ready backend and SDK compatible with React Native to build your app.



                For example, ConnectyCube has added React Native support to its JavaScript SDK. It has a lot of features useful for building chat applications for various purposes.



                Check their documentation how you can build it.



                Here is a useful guide how to build an XMPP chat in React Native.






                share|improve this answer













                Redis is a database and is often used in backend solutions.
                As I understand you are trying to implement a client-side solution in React Native.



                To make it simpler you can use a ready backend and SDK compatible with React Native to build your app.



                For example, ConnectyCube has added React Native support to its JavaScript SDK. It has a lot of features useful for building chat applications for various purposes.



                Check their documentation how you can build it.



                Here is a useful guide how to build an XMPP chat in React Native.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 4 at 15:56









                Iris KrasuckiIris Krasucki

                816




                816






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53532428%2fhow-to-implement-publish-subscribe-feature-with-a-server-in-react-native%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)