Realtime (socket.io)
DontManage ships with an API for realtime events based on socket.io. Since socket.io needs a Node server to run, we run a Node process in parallel to the main web server.
dontmanage.realtime.on
To listen to realtime events on the client (browser), you can use the dontmanage.realtime.on method:
dontmanage.realtime.on('event_name', (data) => {
console.log(data)
})
dontmanage.realtime.off
Stop listening to an event you have subscribed to:
dontmanage.realtime.off('event_name')
dontmanage.publish_realtime
To publish a realtime event from the server, you can use the dontmanage.publish_realtime method:
dontmanage.publish_realtime('event_name', data={'key': 'value'})
dontmanage.publish_progress
You can use this method to show a progress bar in a dialog:
dontmanage.publish_progress(25, title='Some title', description='Some description')
