Skip to content

Commit

Permalink
WebSocket.send_bytes is a coroutine as of aiohttp 3.0 changing transp…
Browse files Browse the repository at this point in the history
…ort.write to await the coroutine if necessary.
  • Loading branch information
Seth Sims committed Mar 20, 2018
1 parent 0bd35d3 commit b2d0e7e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aiogremlin/driver/aiohttp/transport.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import aiohttp

from gremlin_python.driver import transport
Expand All @@ -18,8 +19,10 @@ async def connect(self, url, *, ssl_context=None):
self._ws = await self._client_session.ws_connect(url)
self._connected = True

def write(self, message):
self._ws.send_bytes(message)
async def write(self, message):
corou = self._ws.send_bytes(message)
if asyncio.iscoroutine(corou):
await corou

async def read(self):
data = await self._ws.receive()
Expand Down

0 comments on commit b2d0e7e

Please sign in to comment.