From d99c5b493a527329520cca1be6c69af8ba610d15 Mon Sep 17 00:00:00 2001 From: okxv5api Date: Thu, 15 Dec 2022 21:10:00 +0800 Subject: [PATCH] support websocket --- okx/websocket/WsClientFactory.py | 2 +- okx/websocket/WsConnectManager.py | 4 ++-- okx/websocket/WsPrivate.py | 5 ++--- okx/websocket/WsPublic.py | 2 +- test/WsPublicTest.py | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/okx/websocket/WsClientFactory.py b/okx/websocket/WsClientFactory.py index a003ac0..c016222 100644 --- a/okx/websocket/WsClientFactory.py +++ b/okx/websocket/WsClientFactory.py @@ -1,7 +1,7 @@ from autobahn.twisted.websocket import WebSocketClientFactory from twisted.internet.protocol import ReconnectingClientFactory -from WsClientProtocol import * +from .WsClientProtocol import * class WsReconnectingClientFactory(ReconnectingClientFactory): diff --git a/okx/websocket/WsConnectManager.py b/okx/websocket/WsConnectManager.py index 7343ea7..cd71eda 100644 --- a/okx/websocket/WsConnectManager.py +++ b/okx/websocket/WsConnectManager.py @@ -5,8 +5,8 @@ from autobahn.twisted.websocket import connectWS from twisted.internet import reactor from twisted.internet.error import ReactorAlreadyRunning -import WsUtils -from WsClientFactory import * +from . import WsUtils +from .WsClientFactory import * class WsConnectManager(threading.Thread): diff --git a/okx/websocket/WsPrivate.py b/okx/websocket/WsPrivate.py index 7dd8433..b1bb189 100644 --- a/okx/websocket/WsPrivate.py +++ b/okx/websocket/WsPrivate.py @@ -1,9 +1,8 @@ -import time from twisted.internet import reactor -import WsUtils -from WsConnectManager import WsConnectManager +from . import WsUtils +from .WsConnectManager import WsConnectManager class WsPrivate(WsConnectManager): diff --git a/okx/websocket/WsPublic.py b/okx/websocket/WsPublic.py index a3f24b6..c38e9d7 100644 --- a/okx/websocket/WsPublic.py +++ b/okx/websocket/WsPublic.py @@ -1,6 +1,6 @@ from twisted.internet import reactor -from WsConnectManager import WsConnectManager +from .WsConnectManager import WsConnectManager class WsPublic(WsConnectManager): diff --git a/test/WsPublicTest.py b/test/WsPublicTest.py index 573537d..6a56990 100644 --- a/test/WsPublicTest.py +++ b/test/WsPublicTest.py @@ -6,7 +6,7 @@ def publicCallback(message): if __name__ == '__main__': - url = "wss://ws.okx.com:8443/ws/v5/public" + url = "wss://wspri.coinall.ltd:8443/ws/v5/public?brokerId=9999" ws = WsPublic(url=url) ws.start() args = []