Hi,
What is the best way to architect a Django Channels app that provides a
very fast infinite stream of market data? This is what I have so far, but I
think it's not the best solution.
This data is updated every millisecond so I would prefer to not persist it
(unless there is a way of using redis pub/sub without actually saving the
data, only for messaging)
class ChatConsumer(WebsocketConsumer):
def connect(self):
self.room_name = 'foo'
self.room_group_name = 'foo'
async_to_sync(self.channel_layer.group_add)(
self.room_group_name,
self.channel_name
)
self.accept()
while True:
# Imagine this is another WS feed or Zero MQ Feed.
feed = Feed(....)
for event in feed:
if event.name == "text":
data = event.json
self.send(str(data)
--
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/01bf458c-ff1a-4cf6-bd58-da9b2f43123c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.