Try ERPNext Buy Support Partners Foundation

How to get a realtime update from background services in erpnext

I am trying to run a background service in erpnext and as well get the progress updates.
but then it’s not working as I expected.

my controller code.

frappe.publish_realtime('data_import_applicant', 'Starting long job...')
y = json.loads(data)
for x in y:
	if x['approved'] == "true" and not frappe.db.get_value("Pre Screening", {"job_applicant": x['name']}):
		frappe.get_doc(dict(doctype = 'Pre Screening',job_applicant = x['name'], status= "Pre Screening")).insert(ignore_permissions=True)
		frappe.db.set_value("Applicants", {"name": x["name"]}, "status","Pre Screening")
frappe.publish_realtime('data_import_applicant', 'Ending long job...')

my js code in listview_settings:

refresh:function(me){
        frappe.realtime.on('data_import_applicant', data => {
            console.log("Progressing ooo - ", data);
        });
 },

but is not working.