class websever (threading.Thread):
def init(self, threadID, name):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.loop=asyncio.new_event_loop()
def getloop(self):
return self.loop
def run(self):
print ("开始线程:" + self.name)
# asyncio.get_child_watcher()
asyncio.set_event_loop(self.loop)
app = web.Application()
app.add_routes([web.get('/wssev', fun.websocket_handler1),
web.get('/probe', fun.probe),
web.get('/flash',fun.getflash),
web.get('/force',fun.force_trade_day),
web.get('/reset',fun.reset),
])
asyncio.run(web.run_app(app, port=9999))