[Solved]-Push Notification in DRF

6๐Ÿ‘

Django REST framework is for creating API in django using built in django functionalities to retrieve request and serve response.

Django by itself doesnโ€™t support any protocol that will allow push notifications to be sent to client, so DRF also wonโ€™t do that.

To create push notifications you have to use websockets, there are some third-party packages adding support of websockets to django. One of them is django-websocket-redis

๐Ÿ‘คGwynBleidD

3๐Ÿ‘

If you are looking for push notification on the web (using web socket), you can try to use Firebase Cloud messaging (FCM, Firebase is free with certain usage threshold). What you need is adding code to your django server to request Firebase to send notifications.

If you are looking for push notifications on mobile devices, django-push-notifications package looks good, it even provide support for DRF to keep track of devices. On Android, this will also use FCM as well.

๐Ÿ‘คNathan Do

3๐Ÿ‘

django-push-notifications is the one you are looking for. It is simple and can be implemented with few lines of code. It can be used for all android, iOS and web push notifications.

๐Ÿ‘คBinod Kafle

0๐Ÿ‘

My Personal Favourite for this Purpose is: Django Notification! And Django Pushy!

Other Packages: django-push-notifications Django Activity Stream

Try using the django-instapush package. It is easily available to install via pip. This support all sql databases and also mongoDB via mongoengine to store device information. It has built-in models that can be used to store device information so this will work out of the box. Here is a little tutorial on sending django push notifications using django instapush.

You can Also use:

https://pypi.org/project/django-sns-mobile-push-notification/

You can also try with some other push providers. Infobip Push has some new things, for example you can track users by their locations and send push whenever they are apporaching some areas

๐Ÿ‘คSyed Faizan

0๐Ÿ‘

If you intend to use WebSocket to implement your own notification, you can check out channels

๐Ÿ‘คpeteeelol

0๐Ÿ‘

If you project DRF was structured without asynchronous process in mind. You can try out django channels rest framework. you can easily pass asynch classes to you viewsets and make your endpoints behave like an asynchronous porcess.

๐Ÿ‘คlvingstone

Leave a comment