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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현