support websocket
This commit is contained in:
parent
03ed8b9dca
commit
d99c5b493a
|
|
@ -1,7 +1,7 @@
|
||||||
from autobahn.twisted.websocket import WebSocketClientFactory
|
from autobahn.twisted.websocket import WebSocketClientFactory
|
||||||
from twisted.internet.protocol import ReconnectingClientFactory
|
from twisted.internet.protocol import ReconnectingClientFactory
|
||||||
|
|
||||||
from WsClientProtocol import *
|
from .WsClientProtocol import *
|
||||||
|
|
||||||
|
|
||||||
class WsReconnectingClientFactory(ReconnectingClientFactory):
|
class WsReconnectingClientFactory(ReconnectingClientFactory):
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ from autobahn.twisted.websocket import connectWS
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet.error import ReactorAlreadyRunning
|
from twisted.internet.error import ReactorAlreadyRunning
|
||||||
|
|
||||||
import WsUtils
|
from . import WsUtils
|
||||||
from WsClientFactory import *
|
from .WsClientFactory import *
|
||||||
|
|
||||||
|
|
||||||
class WsConnectManager(threading.Thread):
|
class WsConnectManager(threading.Thread):
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import time
|
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import WsUtils
|
from . import WsUtils
|
||||||
from WsConnectManager import WsConnectManager
|
from .WsConnectManager import WsConnectManager
|
||||||
|
|
||||||
|
|
||||||
class WsPrivate(WsConnectManager):
|
class WsPrivate(WsConnectManager):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
from WsConnectManager import WsConnectManager
|
from .WsConnectManager import WsConnectManager
|
||||||
|
|
||||||
|
|
||||||
class WsPublic(WsConnectManager):
|
class WsPublic(WsConnectManager):
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ def publicCallback(message):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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 = WsPublic(url=url)
|
||||||
ws.start()
|
ws.start()
|
||||||
args = []
|
args = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue