Last active
September 12, 2016 18:00
-
-
Save davebshow/3a0b0679620ddbd9c23eaaa2ddca1411 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import uvloop | |
from aiohttp import ClientSession | |
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) | |
msg = b'\x10application/json{"processor": "", "op": "eval", "args": {"aliases": {}, "gremlin": "x + x", "bindings": {"x": 1}}, "requestId": "2f52dced-0c4d-4ccd-a8a6-62a59bbb52af"}' | |
async def test(): | |
session = ClientSession() | |
ws = await session.ws_connect('ws://localhost:8182/gremlin') | |
for x in range(1200): | |
ws.send_bytes(msg) | |
await receive(ws) | |
await session.close() | |
async def receive(ws): | |
for x in range(1200): | |
resp = await ws.receive() | |
# print(resp) | |
await ws.close() | |
def go(): | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(test()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment