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.