initial candle request limit, better error reporting, split up _handle_producer_connection
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Union
|
||||
from typing import Any, Tuple, Union
|
||||
|
||||
from fastapi import WebSocket as FastAPIWebSocket
|
||||
from websockets import WebSocketClientProtocol as WebSocket
|
||||
@@ -15,6 +15,14 @@ class WebSocketProxy:
|
||||
def __init__(self, websocket: WebSocketType):
|
||||
self._websocket: Union[FastAPIWebSocket, WebSocket] = websocket
|
||||
|
||||
@property
|
||||
def remote_addr(self) -> Tuple[Any, ...]:
|
||||
if hasattr(self._websocket, "remote_address"):
|
||||
return self._websocket.remote_address
|
||||
elif hasattr(self._websocket, "client"):
|
||||
return tuple(self._websocket.client)
|
||||
return ("unknown", 0)
|
||||
|
||||
async def send(self, data):
|
||||
"""
|
||||
Send data on the wrapped websocket
|
||||
|
||||
Reference in New Issue
Block a user