38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from optparse import OptionParser
|
|
|
|
from tornado import gen
|
|
from tornado import httpclient
|
|
from tornado import httputil
|
|
from tornado import ioloop
|
|
from tornado import websocket
|
|
|
|
import virtualclient
|
|
|
|
@gen.coroutine
|
|
def createVirtualClient(account, ws_url):
|
|
virtualclient.VirtualClient(ws_url, account).run()
|
|
|
|
@gen.coroutine
|
|
def main():
|
|
parser = OptionParser(usage="%prog [options]")
|
|
parser.add_option("-a",
|
|
"--accounts",
|
|
dest = "accounts",
|
|
help = "account info")
|
|
(options, args) = parser.parse_args()
|
|
|
|
# ws_url = args if args else 'wss://relation-test.kingsome.cn/friend/websocket'
|
|
ws_url = args if args else 'ws://192.168.100.21:8911/friend/websocket'
|
|
accounts = options.accounts.split(',')
|
|
accounts = []
|
|
for i in range(1):
|
|
accounts.append('testa' + str(i))
|
|
for account in accounts:
|
|
ioloop.IOLoop.current().spawn_callback(createVirtualClient, account, ws_url)
|
|
|
|
while True:
|
|
yield gen.sleep(0.1)
|
|
|
|
if __name__ == '__main__':
|
|
ioloop.IOLoop.current().run_sync(main)
|