fanout / django-eventstream

Server-Sent Events for Django
MIT License
650 stars 85 forks source link

Which file do i put the send_event info into? #29

Closed Bluetip33 closed 5 years ago

Bluetip33 commented 5 years ago

Hi, I have got to the to the part, where you place the send_event info into a file but i don't know which file?.

Thanks.

jkarneges commented 5 years ago

Any file. Call send_event() whenever you need to send an event. For example, in a view handler.

Bluetip33 commented 5 years ago

Hi, Sorry i'm new to Django and still don't understand, can a view handler be the views.py. And if i put it in there, it would go in a function which needs to return a HttpRepsonse but the send_event('test', 'message', {'text': 'hello world'}) doesn't.

Thanks for any help.

jkarneges commented 5 years ago

Exactly. For example, in the chat example, you can see the messages function which calls send_event.

Bluetip33 commented 5 years ago

Thanks for the help, checking it out now.