fanout / django-eventstream

Server-Sent Events for Django
MIT License
638 stars 84 forks source link

DRF support #87

Open jayvdb opened 2 years ago

jayvdb commented 2 years ago

There are a lot of examples of using django-eventstream with django-rest-framework (DRF) views. I wonder if would be acceptable to contribute an example into examples/ which explains how to do this.

This may not be the best usage of django-eventstream, as it would only be a subset of functionality, however there are times when DRF support is extremely important. For example, the more expansive DRF authentication may be needed. Also DRF has support for describing the API endpoints, however there is not (yet) any explicit support for SSE within Swagger/OpenAPI. Some people may feel it is important for the SSE endpoints to be within existing routes managed by DRF, which account for API versioning, language negotiation, and other features.

Also DRF provides well known serialization mechanics, which a project may feel they need to re-use for their SSE. This can be done without the tighter integration of using DRF views.

jkarneges commented 2 years ago

Hi! That sounds like a great idea. Feel free to send a PR.