Fsocket
Get realtime updates in your mobile/web app from frappe and erpnext
- Author: pifabs
- Repository: https://github.com/pifabs/fsocket
- GitHub stars: 32
- Forks: 25
- License: NOASSERTION
- Category: Developer Tools
- Maintenance: Unmaintained
Install Fsocket
bench get-app https://github.com/pifabs/fsocket
Tags
- erpnext
- erpnext-customization
- frappe-framework
- redis
- socketio
Add the Frappe Gems badge to your README
Maintain Fsocket? Paste this into your README:
[](https://frappegems.com/gems/apps/pifabs/fsocket)
About Fsocket
Fsocket
Extend frappe\'s websocket server using socket.io and redis
Installation
Use frappe bench to add fsocket in your project
$ bench get-app https://github.com/pifabs/fsocket.git
Usage
Add "fsocketioport" key in your commonsite_config.json file and set the value to an unused port number
{
...,
"fsocketio_port": 9002
}
Add the ff. line in your Procfile
...
fsocket_server: /usr/bin/node apps/fsocket/socketio.js
...
This will automatically launch a socket io server when you run "bench start"
...
22:27:01 system | socketio.1 started (pid=28536)
22:27:02 fsocket_server.1 | listening on *: 9002
22:27:03 socketio.1 | listening on *: 9001
...
Now we listen to events emitted by frappe.publish_realtime()
...
subscriber.on("message", function (channel, message, room) {
message = JSON.parse(message);
if (message.room) {
io.to(message.room).emit(message.event, message.message);
} else {
io.emit(message.event, message.message);
}
});
...

We can also listen to events emitted by the client
...
io.on('connection', function (socket) {
socket.on("msgprint", function(message) {
console.log("message from client", message);
});
});
...

Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Related Developer Tools apps for Frappe & ERPNext
- Frappe — Low code web framework for real world applications, in Python and Javascript
- Frappe Docker — Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development
- Builder — Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly
- Bench — CLI to manage Multi-tenant deployments for Frappe apps
- Frappe Ui — A set of components and utilities for rapid UI development
- Press — Full service cloud hosting for the Frappe stack - powers Frappe Cloud
- Gameplan — Open Source Discussions Platform for Remote Teams
- Doppio — A Frappe app (CLI) to magically setup single page applications and Vue/React powered desk pages on your custom Frappe apps.