Skip to content

Commit

Permalink
Fix signature
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Aug 16, 2024
1 parent 4bed680 commit 89395c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/hypha_rpc/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.20.21.post2"
"version": "0.20.21.post3"
}
14 changes: 10 additions & 4 deletions python/hypha_rpc/pyodide_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

local_websocket_patch = """
class LocalWebSocket {
constructor(url, client_id, workspace) {
constructor(url) {
this.url = url;
this.onopen = () => {};
this.onmessage = () => {};
this.onclose = () => {};
this.onerror = () => {};
this.client_id = client_id;
this.workspace = workspace;
this.client_id = "{{CLIENT_ID}}";
this.workspace = "{{WORKSPACE}}";
const context = typeof window !== "undefined" ? window : self;
const isWindow = typeof window !== "undefined";
this.postMessage = message => {
Expand Down Expand Up @@ -148,7 +148,13 @@ def __init__(
self._enable_reconnect = False
self.manager_id = None
if self._server_url.startswith("wss://local-hypha-server:"):
self._WebSocketClass = js.eval("(" + local_websocket_patch + ")")
self._WebSocketClass = js.eval(
"("
+ local_websocket_patch.replace("{{CLIENT_ID}}", client_id).replace(
"{{WORKSPACE}}", workspace
)
+ ")"
)
else:
self._WebSocketClass = WebSocket

Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "hypha_rpc"
version = "0.20.21.post2"
version = "0.20.21.post3"
description = "Hypha RPC client for connecting to Hypha server for data management and AI model serving"
readme = "README.md"
requires-python = ">=3.6"
Expand Down

0 comments on commit 89395c4

Please sign in to comment.