novu
novu copied to clipboard
🚀 Feature: Novu SDK For Flutter
🔖 Feature description
Novu SDK for Flutter?
🎤 Why is this feature needed ?
Since Flutter is one of the trending framework for building apps, we would love to see the novu sdk for flutter framework.
✌️ How do you aim to achieve this?
I am really not sure what I can do from my end. We have a project where we are planning to create a notification center for user within the app. I have some ideas of opening a socket to our backend and listen for new notifications and update the ui in realtime but want to know are there any plans on getting novu sdk for flutter. If not any idea how can I implement the feature with sockets using novu?
🔄️ Additional Information
No response
👀 Have you spent some time to check if this feature request has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Contributing Guidelines
Are you willing to submit PR?
None
@ShashankSMayya I'm not into Flutter ecosystem but you may want to search some client library for socket.io (or eventually try to implement your own using regular WS client):
- https://github.com/rikulo/socket.io-client-dart
- https://docs.flutter.dev/cookbook/networking/web-sockets
Widget flow:
- Client must initialize session with HTTP request
POST 'https://api.novu.co/v1/widgets/session/initialize'
{
"applicationIdentifier": "<APP ID>",
"subscriberId": "<SUBSCRIBER ID>",
"hmacHash": null
}
As response you will get JSON with
data.token
- you will need it to authorize ws connection
-
After initialization you can init
socket.io
socket with query{ "token": "token from previous step" }
-
Now you can listen for events like:
-
unseen_count_changed
-
unread_count_changed
-
notification_received
- To get initial data (and historical as user for example scrolls) for notification center use HTTP calls:
-
GET https://api.novu.co/v1/widgets/notifications/feed?page=0
- for messages -
GET https://api.novu.co/v1/widgets/notifications/unseen?limit=100
- for unseen number
Use Bearer authorization with token obtained from first step
@scopsy Can you confirm how it works and eventually provide more details? (: I think we need better documentation for custom client-side flows.
@michaldziuba03 this is exactly how it works, you nailed it! :)
Are there any more recent plans for a flutter client sdk? We are evaluating Novu vs Courier and it seems this is something that could be a big win for Courier at the moment.