Skip to content

Commit

Permalink
Proxy fixes (#353)
Browse files Browse the repository at this point in the history
* Use UUID for proxy, print

* Version bump, fix dependencies #352
  • Loading branch information
kjy5 authored Jun 13, 2024
1 parent a04a8b0 commit b98fc5c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies = [
"aiohttp==3.9.5",
"platformdirs==4.2.2",
"pyserial==3.5",
"python-socketio==5.11.2",
"python-socketio[asyncio_client]==5.11.2",
"pythonnet==3.0.3",
"sensapex==1.400.0",
"vbl-aquarium==0.0.14"
Expand All @@ -60,7 +60,6 @@ python = "3.12"
dependencies = [
"coverage[toml]>=6.5",
"pytest",
"python-socketio[asyncio_client]==5.11.2",
]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
Expand Down
2 changes: 1 addition & 1 deletion src/ephys_link/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.1"
__version__ = "1.3.2"
9 changes: 8 additions & 1 deletion src/ephys_link/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
)
parser.add_argument("-d", "--debug", dest="debug", action="store_true", help="Enable debug mode.")
parser.add_argument("-x", "--use-proxy", dest="use_proxy", action="store_true", help="Enable proxy mode.")
parser.add_argument("-a", "--proxy-address", type=str, dest="proxy_address", help="Proxy IP address.")
parser.add_argument(
"-a",
"--proxy-address",
type=str,
default="proxy2.virtualbrainlab.org",
dest="proxy_address",
help="Proxy IP address.",
)
parser.add_argument(
"-p",
"--port",
Expand Down
4 changes: 3 additions & 1 deletion src/ephys_link/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from json import dumps, loads
from signal import SIGINT, SIGTERM, signal
from typing import TYPE_CHECKING, Any
from uuid import uuid4

from aiohttp import ClientConnectionError, ClientSession
from aiohttp.web import Application, run_app
Expand Down Expand Up @@ -428,14 +429,15 @@ async def launch_for_proxy(

# Create AsyncClient.
self.sio = AsyncClient()
self.pinpoint_id = "abcde" # str(uuid4())[:8]
self.pinpoint_id = str(uuid4())[:8]

# Bind events.
self.bind_events()

# Connect and mark that server is running.
await self.sio.connect(f"http://{proxy_address}:{port}")
self.is_running = True
print(f"Pinpoint ID: {self.pinpoint_id}")
await self.sio.wait()

def launch(
Expand Down

0 comments on commit b98fc5c

Please sign in to comment.