Yes, you'd need to do this manually - the databinding in Channels right now is very barebones and doesn't handle initial state versus change management. I'd love to eventually get a full event-sourcing solution done, but I have a lot of things I would like to do!
Andrew On Thu, Sep 7, 2017 at 7:32 AM, <[email protected]> wrote: > Hi, > > I'm creating a prototype using Django Channels and I have a question that > I haven't sorted out yet. First of all, big thanks to all django-channels > developer, this is something I was missing for a long time. > So I have a connection that watches on a model and sends updates to a > frontend. It looks something like this: > > from channels import route_class > from channels.generic.websockets import WebsocketDemultiplexer > > from dataSource.models import DataSourceBinding > > class Demultiplexer(WebsocketDemultiplexer): > consumers = { > "datasource": DataSourceBinding.consumer, > } > > > def connection_groups(self): > return ["datasource-updates"] > > channel_routing = [ > route_class(Demultiplexer, path="^/datasource/") > ] > > It works fine as far as some change is done, but I'd like to get initial > data for an initial render, is there any good trick how to do this? I do I > need to send a message and do it manually somehow? > > Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/2f177119-7043-4571-bb11-e9dacae19dad%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/2f177119-7043-4571-bb11-e9dacae19dad%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1urzmaMXCLQBWqSHauQLbbHpQO-u2GMo5SWA%2BetZEcC1Fw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

