How to implement message notification in React App?












0















I am now building an application using React and Redux as the frontend and Django as the backend. What i am trying to realize is whenever an end user upload a file, all the end users that are related to this file should receive a notification.



I am thinking of using websocket/socket.io but I am not sure if that works well with Django. Or any experience or suggestions of using any other technologies to implement the message notification function?










share|improve this question























  • I think that this question should be on softwarerecs.stackexchange.com instead of here at stackoverflow

    – grouchoboy
    Nov 26 '18 at 15:58
















0















I am now building an application using React and Redux as the frontend and Django as the backend. What i am trying to realize is whenever an end user upload a file, all the end users that are related to this file should receive a notification.



I am thinking of using websocket/socket.io but I am not sure if that works well with Django. Or any experience or suggestions of using any other technologies to implement the message notification function?










share|improve this question























  • I think that this question should be on softwarerecs.stackexchange.com instead of here at stackoverflow

    – grouchoboy
    Nov 26 '18 at 15:58














0












0








0








I am now building an application using React and Redux as the frontend and Django as the backend. What i am trying to realize is whenever an end user upload a file, all the end users that are related to this file should receive a notification.



I am thinking of using websocket/socket.io but I am not sure if that works well with Django. Or any experience or suggestions of using any other technologies to implement the message notification function?










share|improve this question














I am now building an application using React and Redux as the frontend and Django as the backend. What i am trying to realize is whenever an end user upload a file, all the end users that are related to this file should receive a notification.



I am thinking of using websocket/socket.io but I am not sure if that works well with Django. Or any experience or suggestions of using any other technologies to implement the message notification function?







django reactjs sockets socket.io notifications






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 26 '18 at 15:53









fancylynnfancylynn

246




246













  • I think that this question should be on softwarerecs.stackexchange.com instead of here at stackoverflow

    – grouchoboy
    Nov 26 '18 at 15:58



















  • I think that this question should be on softwarerecs.stackexchange.com instead of here at stackoverflow

    – grouchoboy
    Nov 26 '18 at 15:58

















I think that this question should be on softwarerecs.stackexchange.com instead of here at stackoverflow

– grouchoboy
Nov 26 '18 at 15:58





I think that this question should be on softwarerecs.stackexchange.com instead of here at stackoverflow

– grouchoboy
Nov 26 '18 at 15:58












2 Answers
2






active

oldest

votes


















0














A simple Google search revealed Django Channels




Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more. It’s built on a Python specification called ASGI.







share|improve this answer
























  • So this means i should use Django channel for the backend to handle the front-end websocket right?

    – fancylynn
    Nov 27 '18 at 19:36











  • exactly, tinker a little bit with it and it will be easier to understand.

    – Fawzi
    Nov 29 '18 at 6:15



















0














Using the field_field.files[0].file.slice() method in javascript you can send a file in chunks over a websocket. Using field_field.files[0].size you can get the total size and divide the total of what you've sent and the size of the file to build a progress bar. Make sure you wrap your file writes in the @sync_to_async decorator as doing it without that would block the event loop. That method is part of Channels and found in Asgiref.



Channels Redis can be used to notify any or all of the users that an event has occurred, such as a file being uploaded.






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%2f53484772%2fhow-to-implement-message-notification-in-react-app%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









    0














    A simple Google search revealed Django Channels




    Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more. It’s built on a Python specification called ASGI.







    share|improve this answer
























    • So this means i should use Django channel for the backend to handle the front-end websocket right?

      – fancylynn
      Nov 27 '18 at 19:36











    • exactly, tinker a little bit with it and it will be easier to understand.

      – Fawzi
      Nov 29 '18 at 6:15
















    0














    A simple Google search revealed Django Channels




    Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more. It’s built on a Python specification called ASGI.







    share|improve this answer
























    • So this means i should use Django channel for the backend to handle the front-end websocket right?

      – fancylynn
      Nov 27 '18 at 19:36











    • exactly, tinker a little bit with it and it will be easier to understand.

      – Fawzi
      Nov 29 '18 at 6:15














    0












    0








    0







    A simple Google search revealed Django Channels




    Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more. It’s built on a Python specification called ASGI.







    share|improve this answer













    A simple Google search revealed Django Channels




    Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more. It’s built on a Python specification called ASGI.








    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 26 '18 at 15:59









    FawziFawzi

    267110




    267110













    • So this means i should use Django channel for the backend to handle the front-end websocket right?

      – fancylynn
      Nov 27 '18 at 19:36











    • exactly, tinker a little bit with it and it will be easier to understand.

      – Fawzi
      Nov 29 '18 at 6:15



















    • So this means i should use Django channel for the backend to handle the front-end websocket right?

      – fancylynn
      Nov 27 '18 at 19:36











    • exactly, tinker a little bit with it and it will be easier to understand.

      – Fawzi
      Nov 29 '18 at 6:15

















    So this means i should use Django channel for the backend to handle the front-end websocket right?

    – fancylynn
    Nov 27 '18 at 19:36





    So this means i should use Django channel for the backend to handle the front-end websocket right?

    – fancylynn
    Nov 27 '18 at 19:36













    exactly, tinker a little bit with it and it will be easier to understand.

    – Fawzi
    Nov 29 '18 at 6:15





    exactly, tinker a little bit with it and it will be easier to understand.

    – Fawzi
    Nov 29 '18 at 6:15













    0














    Using the field_field.files[0].file.slice() method in javascript you can send a file in chunks over a websocket. Using field_field.files[0].size you can get the total size and divide the total of what you've sent and the size of the file to build a progress bar. Make sure you wrap your file writes in the @sync_to_async decorator as doing it without that would block the event loop. That method is part of Channels and found in Asgiref.



    Channels Redis can be used to notify any or all of the users that an event has occurred, such as a file being uploaded.






    share|improve this answer




























      0














      Using the field_field.files[0].file.slice() method in javascript you can send a file in chunks over a websocket. Using field_field.files[0].size you can get the total size and divide the total of what you've sent and the size of the file to build a progress bar. Make sure you wrap your file writes in the @sync_to_async decorator as doing it without that would block the event loop. That method is part of Channels and found in Asgiref.



      Channels Redis can be used to notify any or all of the users that an event has occurred, such as a file being uploaded.






      share|improve this answer


























        0












        0








        0







        Using the field_field.files[0].file.slice() method in javascript you can send a file in chunks over a websocket. Using field_field.files[0].size you can get the total size and divide the total of what you've sent and the size of the file to build a progress bar. Make sure you wrap your file writes in the @sync_to_async decorator as doing it without that would block the event loop. That method is part of Channels and found in Asgiref.



        Channels Redis can be used to notify any or all of the users that an event has occurred, such as a file being uploaded.






        share|improve this answer













        Using the field_field.files[0].file.slice() method in javascript you can send a file in chunks over a websocket. Using field_field.files[0].size you can get the total size and divide the total of what you've sent and the size of the file to build a progress bar. Make sure you wrap your file writes in the @sync_to_async decorator as doing it without that would block the event loop. That method is part of Channels and found in Asgiref.



        Channels Redis can be used to notify any or all of the users that an event has occurred, such as a file being uploaded.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 14 '18 at 18:36









        kagronickkagronick

        8741516




        8741516






























            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%2f53484772%2fhow-to-implement-message-notification-in-react-app%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

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

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