Skip to content

Commit

Permalink
Allow passing reconnection_token
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Jul 25, 2024
1 parent 1434252 commit 069319c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions javascript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypha-rpc",
"version": "0.1.5",
"version": "0.1.6",
"description": "Hypha RPC client for connecting to Hypha server for data management and AI model serving.",
"main": "index.js",
"types": "index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion javascript/src/websocket-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class WebsocketRPCConnection {
client_id,
workspace,
token,
reconnection_token = null,
timeout = 60,
WebSocketClass = null,
) {
Expand All @@ -22,7 +23,7 @@ class WebsocketRPCConnection {
this._client_id = client_id;
this._workspace = workspace;
this._token = token;
this._reconnection_token = null;
this._reconnection_token = reconnection_token;
this._websocket = null;
this._handle_message = null;
this._handle_connect = null; // Connection open event handler
Expand Down Expand Up @@ -333,6 +334,7 @@ export async function connectToServer(config) {
clientId,
config.workspace,
config.token,
config.reconnection_token,
config.method_timeout || 60,
config.WebSocketClass,
);
Expand Down
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.1.5"
"version": "0.1.6"
}
6 changes: 3 additions & 3 deletions python/hypha_rpc/websocket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
import sys

import msgpack
import shortuuid
import json

Expand Down Expand Up @@ -41,7 +40,7 @@ def custom_exception_handler(loop, context):
class WebsocketRPCConnection:
"""Represent a websocket connection."""

def __init__(self, server_url, client_id, workspace=None, token=None, timeout=60):
def __init__(self, server_url, client_id, workspace=None, token=None, reconnection_token=None, timeout=60):
"""Set up instance."""
self._websocket = None
self._handle_message = None
Expand All @@ -53,7 +52,7 @@ def __init__(self, server_url, client_id, workspace=None, token=None, timeout=60
self._workspace = workspace
self._token = token
self._handle_reconnect = None
self._reconnection_token = None
self._reconnection_token = reconnection_token
self._timeout = timeout
self._closed = False
self._legacy_auth = None
Expand Down Expand Up @@ -319,6 +318,7 @@ async def _connect_to_server(config):
client_id,
workspace=config.get("workspace"),
token=config.get("token"),
reconnection_token=config.get("reconnection_token"),
timeout=config.get("method_timeout", 60),
)
connection_info = await connection.open()
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.1.5"
version = "0.1.6"
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
1 change: 1 addition & 0 deletions scripts/bump-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def update_package_lock_json(version):
with open('javascript/package-lock.json', 'r+') as f:
data = json.load(f)
data['version'] = version
data['packages']['']['version'] = version
f.seek(0)
json.dump(data, f, indent=2)
f.truncate()
Expand Down

0 comments on commit 069319c

Please sign in to comment.