Skip to content

Commit 3632ebc

Browse files
authored
Merge pull request #99 from Murugurugan/main
Updating to websockets 14.2
2 parents d7c60cb + c62ac71 commit 3632ebc

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
aiofiles==23.2.1
22
python-dotenv==1.0.1
3-
websockets==12.0
3+
websockets

runware/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import inspect
1111
from typing import List, Union, Optional, Callable, Any, Dict
1212
from urllib.parse import urlparse
13+
from websockets.protocol import State
1314

1415
from .utils import (
1516
BASE_RUNWARE_URLS,
@@ -102,7 +103,7 @@ def __init__(
102103
self._sdkType: SdkType = SdkType.SERVER
103104

104105
def isWebsocketReadyState(self) -> bool:
105-
return self._ws and self._ws.open
106+
return self._ws and self._ws.state is State.OPEN
106107

107108
def isAuthenticated(self):
108109
return self._connectionSessionUUID is not None
@@ -1134,7 +1135,7 @@ async def ensureConnection(self) -> None:
11341135
11351136
:raises: An error message if the connection cannot be established due to an invalid API key or other reasons.
11361137
"""
1137-
isConnected = self.connected() and self._ws.open
1138+
isConnected = self.connected() and self._ws.state is State.OPEN
11381139
# print(f"Is connected: {isConnected}")
11391140

11401141
try:

runware/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import logging
44
import websockets
5+
from websockets.protocol import State
56
import inspect
67
import pprint
78
from typing import Any, Callable, Dict, List, Union, Optional, TypeVar
@@ -207,7 +208,7 @@ async def send(self, msg: Dict[str, Any]):
207208
# print(
208209
# f"=============================================== End sending message ===============================================================\n\n\n"
209210
# )
210-
if self._ws and self._ws.open:
211+
if self._ws and self._ws.state is State.OPEN:
211212
await self._ws.send(json.dumps(msg))
212213

213214
def _get_task_by_name(self, name):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# Add your SDK's dependencies here
3737
"aiofiles==23.2.1",
3838
"python-dotenv==1.0.1",
39-
"websockets==12.0",
39+
"websockets",
4040
# ...
4141
],
4242
)

0 commit comments

Comments
 (0)