@click.command(u'publish-realtime')
@click.argument(u'event')
@click.option(u'--message')
@click.option(u'--room')
@click.option(u'--user')
@click.option(u'--doctype')
@click.option(u'--docname')
@click.option(u'--after-commit')
@pass_context
def publish_realtime(context, event, message, room, user, doctype, docname, after_commit):
 from frappe import publish_realtime
 for site in context.sites:
  try:
   frappe.init(site=site)
   frappe.connect()
   publish_realtime(event, message=message, room=room, user=user, doctype=doctype, docname=docname, after_commit=after_commit)
   frappe.db.commit()
  finally:
   frappe.destroy()

@ click . command ( u'publish-realtime' ) @ click . argument ( u'event' ) @ click . option ( u'--message' ) @ click . option ( u'--room' ) @ click . option ( u'--user' ) @ click . option ( u'--doctype' ) @ click . option ( u'--docname' ) @ click . option ( u'--after-commit' ) @ pass_context def publish_realtime ( context , event , message , room , user , doctype , docname , after_commit ) : from frappe import publish_realtime for site in context . sites : try : frappe . init ( site = site ) frappe . connect ( ) publish_realtime ( event , message = message , room = room , user = user , doctype = doctype , docname = docname , after_commit = after_commit ) frappe . db . commit ( ) finally : frappe . destroy ( )
publish realtime event from bench .