cleanup old code
This commit is contained in:
parent
379b1cbc90
commit
b3b0c918d9
@ -64,15 +64,3 @@ class WSAnalyzedDFMessage(WSMessageSchema):
|
||||
data: AnalyzedDFData
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
message = WSAnalyzedDFMessage(
|
||||
data={
|
||||
"key": ("1", "5m", "spot"),
|
||||
"df": DataFrame(),
|
||||
"la": datetime.now()
|
||||
}
|
||||
)
|
||||
|
||||
print(message)
|
||||
|
@ -46,16 +46,6 @@ class JSONWebSocketSerializer(WebSocketSerializer):
|
||||
return json.loads(data, object_hook=_json_object_hook)
|
||||
|
||||
|
||||
# ORJSON does not support .loads(object_hook=x) parameter, so we must use RapidJSON
|
||||
|
||||
class RapidJSONWebSocketSerializer(WebSocketSerializer):
|
||||
def _serialize(self, data):
|
||||
return rapidjson.dumps(data, default=_json_default)
|
||||
|
||||
def _deserialize(self, data):
|
||||
return rapidjson.loads(data, object_hook=_json_object_hook)
|
||||
|
||||
|
||||
class HybridJSONWebSocketSerializer(WebSocketSerializer):
|
||||
def _serialize(self, data) -> str:
|
||||
return str(orjson.dumps(data, default=_json_default), "utf-8")
|
||||
|
@ -1,12 +0,0 @@
|
||||
from fastapi import WebSocket
|
||||
# fastapi does not make this available through it, so import directly from starlette
|
||||
from starlette.websockets import WebSocketState
|
||||
|
||||
|
||||
async def is_websocket_alive(ws: WebSocket) -> bool:
|
||||
if (
|
||||
ws.application_state == WebSocketState.CONNECTED and
|
||||
ws.client_state == WebSocketState.CONNECTED
|
||||
):
|
||||
return True
|
||||
return False
|
Loading…
Reference in New Issue
Block a user