async def register_contacts(self): contact_svc = self.get_service('contact_svc') await contact_svc.register(Http(self.get_services())) await contact_svc.register(Udp(self.get_services())) await contact_svc.register(Tcp(self.get_services())) await contact_svc.register(WebSocket(self.get_services())) await contact_svc.register(Html(self.get_services()))
def run_tasks(services): loop = asyncio.get_event_loop() loop.create_task(build_docs()) loop.run_until_complete(data_svc.restore_state()) loop.run_until_complete(RestApi(services).enable()) loop.run_until_complete(contact_svc.register(Http(services))) loop.run_until_complete(contact_svc.register(Udp(services))) loop.run_until_complete(contact_svc.register(Tcp(services))) loop.run_until_complete(app_svc.load_plugins()) loop.run_until_complete(app_svc.add_app_plugin()) loop.run_until_complete(data_svc.load_data()) loop.create_task(app_svc.start_sniffer_untrusted_agents()) loop.create_task(app_svc.resume_operations()) loop.create_task(app_svc.run_scheduler()) loop.run_until_complete(start_server()) try: logging.info('All systems ready.') loop.run_forever() except KeyboardInterrupt: loop.run_until_complete(services.get('app_svc').teardown())