django channels with redis: messages created before websocket connection established are lostDjango - How to track if a user is online/offline in realtime?Sending messages to django-channels via celeryDjango Channels Websockets Connecting and Disconnecting right awayBest practice for Websocket authentification - Django ChannelsUsing Django Channels to send info to all connected clientsDjango channels websocket disconnects after handshakeDjango Channels send message from python websocket-client moduleHow should I configure Redis for Django Channels 2.0?Django websockets with RedisDjango channels redis channel layer opens a lot of connectionssending message to client using Django Channels from Celery tasks.py

A player is constantly pestering me about rules, what do I do as a DM?

MH370 blackbox - is it still possible to retrieve data from it?

Alphabet completion rate

How exactly is a normal force exerted, at the molecular level?

SPI Waveform on Raspberry Pi Not clean and I'm wondering why

Generate and graph the Recamán Sequence

How to modify the uneven space between separate loop cuts, while they are already cut?

Should I hide continue button until tasks are completed?

Is there a short way to check uniqueness of values without using 'if' and multiple 'and's?

Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?

If my Scout rogue has used his full movement on his turn, can he later use the reaction from the Skirmisher feature to move again?

What are good ways to spray paint a QR code on a footpath?

AT system without -5v

Do I have to roll to maintain concentration if a target other than me who is affected by my concentration spell takes damage?

Bash echo $-1 prints hb1. Why?

How do I get a European Union Pet Passport for my dog?

When is it ok to add filler to a story?

Zombie Diet, why humans

How should I behave to assure my friends that I am not after their money?

Wilcoxon signed rank test – critical value for n>50

Was "I have the farts, again" broadcast from the Moon to the whole world?

how to remove the dotted white border around focused button text?

“Transitive verb” + interrupter+ “object”?

Would adding an external lens allow one area outside the focal plane to be in focus?



django channels with redis: messages created before websocket connection established are lost


Django - How to track if a user is online/offline in realtime?Sending messages to django-channels via celeryDjango Channels Websockets Connecting and Disconnecting right awayBest practice for Websocket authentification - Django ChannelsUsing Django Channels to send info to all connected clientsDjango channels websocket disconnects after handshakeDjango Channels send message from python websocket-client moduleHow should I configure Redis for Django Channels 2.0?Django websockets with RedisDjango channels redis channel layer opens a lot of connectionssending message to client using Django Channels from Celery tasks.py






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have managed to get django sending messages to a browser websocket client using channels. But I don't understand it very well.



Messages my Celery background task creates before the websocket handshake from the browser do not get shown.



messages are sent with



async_to_sync(channel_layer.group_send)(str(job.id),..)


Django v 2.1.7.



The channel layer uses redis so group_send is from channels_redis and the first argument is the group id. I would like a client connecting with the job.id to get all messages ever sent to that group.



Does this make sense?










share|improve this question




























    0















    I have managed to get django sending messages to a browser websocket client using channels. But I don't understand it very well.



    Messages my Celery background task creates before the websocket handshake from the browser do not get shown.



    messages are sent with



    async_to_sync(channel_layer.group_send)(str(job.id),..)


    Django v 2.1.7.



    The channel layer uses redis so group_send is from channels_redis and the first argument is the group id. I would like a client connecting with the job.id to get all messages ever sent to that group.



    Does this make sense?










    share|improve this question
























      0












      0








      0








      I have managed to get django sending messages to a browser websocket client using channels. But I don't understand it very well.



      Messages my Celery background task creates before the websocket handshake from the browser do not get shown.



      messages are sent with



      async_to_sync(channel_layer.group_send)(str(job.id),..)


      Django v 2.1.7.



      The channel layer uses redis so group_send is from channels_redis and the first argument is the group id. I would like a client connecting with the job.id to get all messages ever sent to that group.



      Does this make sense?










      share|improve this question














      I have managed to get django sending messages to a browser websocket client using channels. But I don't understand it very well.



      Messages my Celery background task creates before the websocket handshake from the browser do not get shown.



      messages are sent with



      async_to_sync(channel_layer.group_send)(str(job.id),..)


      Django v 2.1.7.



      The channel layer uses redis so group_send is from channels_redis and the first argument is the group id. I would like a client connecting with the job.id to get all messages ever sent to that group.



      Does this make sense?







      django django-channels






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 11:30









      Tim RichardsonTim Richardson

      1,1754 gold badges17 silver badges38 bronze badges




      1,1754 gold badges17 silver badges38 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The messages being sent are not waiting for unknown future clients/connections so you would have to implement that mechanism yourself. You should check if the client is connected before sending the message in which case you should store the message in some table and send it to the client later upon connection.



          The main issue is how to track the online status of the client. I use an approach similar to the one in the answer to this question but it is not very reliable but isn't bad for a start






          share|improve this answer























          • OK. I do already store the messages in a DB. I had a 'DIY' websocket server before, that sent all existing messages to new clients when they connected. I will try to work out how to replicate that with Channels.

            – Tim Richardson
            Mar 25 at 22:05













          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%2f55336816%2fdjango-channels-with-redis-messages-created-before-websocket-connection-establi%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The messages being sent are not waiting for unknown future clients/connections so you would have to implement that mechanism yourself. You should check if the client is connected before sending the message in which case you should store the message in some table and send it to the client later upon connection.



          The main issue is how to track the online status of the client. I use an approach similar to the one in the answer to this question but it is not very reliable but isn't bad for a start






          share|improve this answer























          • OK. I do already store the messages in a DB. I had a 'DIY' websocket server before, that sent all existing messages to new clients when they connected. I will try to work out how to replicate that with Channels.

            – Tim Richardson
            Mar 25 at 22:05















          0














          The messages being sent are not waiting for unknown future clients/connections so you would have to implement that mechanism yourself. You should check if the client is connected before sending the message in which case you should store the message in some table and send it to the client later upon connection.



          The main issue is how to track the online status of the client. I use an approach similar to the one in the answer to this question but it is not very reliable but isn't bad for a start






          share|improve this answer























          • OK. I do already store the messages in a DB. I had a 'DIY' websocket server before, that sent all existing messages to new clients when they connected. I will try to work out how to replicate that with Channels.

            – Tim Richardson
            Mar 25 at 22:05













          0












          0








          0







          The messages being sent are not waiting for unknown future clients/connections so you would have to implement that mechanism yourself. You should check if the client is connected before sending the message in which case you should store the message in some table and send it to the client later upon connection.



          The main issue is how to track the online status of the client. I use an approach similar to the one in the answer to this question but it is not very reliable but isn't bad for a start






          share|improve this answer













          The messages being sent are not waiting for unknown future clients/connections so you would have to implement that mechanism yourself. You should check if the client is connected before sending the message in which case you should store the message in some table and send it to the client later upon connection.



          The main issue is how to track the online status of the client. I use an approach similar to the one in the answer to this question but it is not very reliable but isn't bad for a start







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 14:45









          Ken4scholarsKen4scholars

          1,8342 gold badges9 silver badges18 bronze badges




          1,8342 gold badges9 silver badges18 bronze badges












          • OK. I do already store the messages in a DB. I had a 'DIY' websocket server before, that sent all existing messages to new clients when they connected. I will try to work out how to replicate that with Channels.

            – Tim Richardson
            Mar 25 at 22:05

















          • OK. I do already store the messages in a DB. I had a 'DIY' websocket server before, that sent all existing messages to new clients when they connected. I will try to work out how to replicate that with Channels.

            – Tim Richardson
            Mar 25 at 22:05
















          OK. I do already store the messages in a DB. I had a 'DIY' websocket server before, that sent all existing messages to new clients when they connected. I will try to work out how to replicate that with Channels.

          – Tim Richardson
          Mar 25 at 22:05





          OK. I do already store the messages in a DB. I had a 'DIY' websocket server before, that sent all existing messages to new clients when they connected. I will try to work out how to replicate that with Channels.

          – Tim Richardson
          Mar 25 at 22:05



















          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%2f55336816%2fdjango-channels-with-redis-messages-created-before-websocket-connection-establi%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

          Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

          밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

          1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴