Skip to content

Commit 14b6ff8

Browse files
committed
Fix missing _use_batching attribute in ProjectXRealtimeClient
- Added super().__init__() call to properly initialize all mixins - This ensures EventHandlingMixin and ConnectionManagementMixin are properly initialized - Fixes WebSocket error: 'ProjectXRealtimeClient' object has no attribute '_use_batching' - Added checks to prevent duplicate initialization of shared attributes
1 parent f87f713 commit 14b6ff8

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/project_x_py/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595

9696
from project_x_py.client.base import ProjectXBase
9797

98-
__version__ = "3.1.3"
98+
__version__ = "3.1.4"
9999
__author__ = "TexasCoding"
100100

101101
# Core client classes - renamed from Async* to standard names

src/project_x_py/realtime/core.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ def __init__(
232232
- Both hubs must connect successfully for full functionality
233233
- SignalR connections are established lazily on connect()
234234
"""
235+
# Initialize parent mixins
236+
super().__init__()
237+
235238
self.jwt_token = jwt_token
236239
self.account_id = account_id
237240

@@ -274,8 +277,9 @@ def __init__(
274277
self.market_connected = False
275278
self.setup_complete = False
276279

277-
# Event callbacks (pure forwarding, no caching)
278-
self.callbacks: defaultdict[str, list[Any]] = defaultdict(list)
280+
# Event callbacks (pure forwarding, no caching) - already initialized in mixin
281+
if not hasattr(self, "callbacks"):
282+
self.callbacks: defaultdict[str, list[Any]] = defaultdict(list)
279283

280284
# Basic statistics (no business logic)
281285
self.stats = {
@@ -295,9 +299,8 @@ def __init__(
295299
self.logger.info(f"User Hub: {final_user_url}")
296300
self.logger.info(f"Market Hub: {final_market_url}")
297301

298-
# Async locks for thread-safe operations
299-
self._callback_lock = asyncio.Lock()
300-
self._connection_lock = asyncio.Lock()
301-
302-
# Store the event loop for cross-thread task scheduling
303-
self._loop: asyncio.AbstractEventLoop | None = None
302+
# Async locks for thread-safe operations - check if not already initialized
303+
if not hasattr(self, "_callback_lock"):
304+
self._callback_lock = asyncio.Lock()
305+
if not hasattr(self, "_connection_lock"):
306+
self._connection_lock = asyncio.Lock()

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)