I am developing a Flutter app which connects to frappe via REST API. For messaging purpose i need to integrate frappe socket as server and flutter socket as client. Is there any one having experience regarding this? I am having trouble in connecting sockets. My frappe app is running in url ‘http://jobs.xxxxxxxx.com’. I am using “flutter_socket_io” dart package to connect server.
Following dart code to connect to frappe.
Hi. Thank you for raising this thread. We are also planning same method. Flutter app for ios and Android with ERPNext as backbone for all data. Would you be able to document how you went about integrating app with ERPNext and have 2 way synchronization.
hi @Kirubakaran_Thillaia, @Muzzy , yes rest api is for connection with doctypes… and methods… etc.,
but for socket.io server, do you have some examples ( flutter ) ? … i need it for real time messaging… , thanks…
I used Firebase Cloud Messaging service to push notifications to flutter app via frappe app.
You can use “pyfcm”, fcm’s python module inside frappe app’s server side script to send messaged to flutter app.
Hi, You can refer FCM Firebase Documentation website for more details.
In erpnext python script you can import “from pyfcm import FCMNotification” and by calling you method.
> def spokes_message_socketio(doc, method):
if doc.msg_from == "Admin":
push_service = FCMNotification(
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
user = frappe.get_doc('xyz', doc.mobile_no)
registration_id = user.fcm_id
message_title = "Message from Portal"
message_body = doc.message_from_admin
result = push_service.notify_single_device(
registration_id=registration_id, message_title=message_title, message_body=message_body)
For this you need to store fcm_id while accepting user for the first time.