diff options
Diffstat (limited to 'bitbake/lib/bb/asyncrpc/client.py')
-rw-r--r-- | bitbake/lib/bb/asyncrpc/client.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bitbake/lib/bb/asyncrpc/client.py b/bitbake/lib/bb/asyncrpc/client.py index 7f33099b63..802c07df1f 100644 --- a/bitbake/lib/bb/asyncrpc/client.py +++ b/bitbake/lib/bb/asyncrpc/client.py | |||
@@ -10,7 +10,7 @@ import json | |||
10 | import os | 10 | import os |
11 | import socket | 11 | import socket |
12 | import sys | 12 | import sys |
13 | from .connection import StreamConnection, DEFAULT_MAX_CHUNK | 13 | from .connection import StreamConnection, WebsocketConnection, DEFAULT_MAX_CHUNK |
14 | from .exceptions import ConnectionClosedError | 14 | from .exceptions import ConnectionClosedError |
15 | 15 | ||
16 | 16 | ||
@@ -47,6 +47,15 @@ class AsyncClient(object): | |||
47 | 47 | ||
48 | self._connect_sock = connect_sock | 48 | self._connect_sock = connect_sock |
49 | 49 | ||
50 | async def connect_websocket(self, uri): | ||
51 | import websockets | ||
52 | |||
53 | async def connect_sock(): | ||
54 | websocket = await websockets.connect(uri, ping_interval=None) | ||
55 | return WebsocketConnection(websocket, self.timeout) | ||
56 | |||
57 | self._connect_sock = connect_sock | ||
58 | |||
50 | async def setup_connection(self): | 59 | async def setup_connection(self): |
51 | # Send headers | 60 | # Send headers |
52 | await self.socket.send("%s %s" % (self.proto_name, self.proto_version)) | 61 | await self.socket.send("%s %s" % (self.proto_name, self.proto_version)) |