mirror of
https://github.com/damp11113/IDRB.git
synced 2025-04-27 06:28:09 +00:00
ZeroMQ (WebSocket) update
this update can use cloudflare tunnel for forward port
This commit is contained in:
parent
39701b2225
commit
4e678678ae
@ -113,7 +113,12 @@ class App:
|
||||
s = context.socket(zmq.SUB)
|
||||
s.connect(f"tcp://{ip}:{port}")
|
||||
s.setsockopt_string(zmq.SUBSCRIBE, "")
|
||||
|
||||
elif protocol == "ZeroMQ (WS)":
|
||||
context = zmq.Context()
|
||||
s = context.socket(zmq.SUB)
|
||||
s.connect(f"ws://{ip}:{port}")
|
||||
s.setsockopt_string(zmq.SUBSCRIBE, "")
|
||||
self.cprotocol = "ZeroMQ"
|
||||
self.working = True
|
||||
|
||||
self.device_index_output = 0
|
||||
@ -382,7 +387,7 @@ class App:
|
||||
dpg.add_button(label="select server", tag="selectserverbutton")
|
||||
dpg.add_input_text(label="server ip", tag="serverip", default_value="localhost")
|
||||
dpg.add_input_int(label="port", tag="serverport", max_value=65535, default_value=6980)
|
||||
dpg.add_combo(["TCP", "ZeroMQ"], label="protocol", tag="serverprotocol", default_value="TCP")
|
||||
dpg.add_combo(["TCP", "ZeroMQ", "ZeroMQ (WS)"], label="protocol", tag="serverprotocol", default_value="TCP")
|
||||
dpg.add_button(label="connect", callback=self.connecttoserver, tag="connectbutton")
|
||||
dpg.add_spacer()
|
||||
dpg.add_button(label="More RDS info", callback=lambda: dpg.configure_item("RDSwindow", show=True), tag="morerdsbutton", show=False)
|
||||
|
@ -39,7 +39,7 @@ def encrypt_data(message_bytes, password):
|
||||
return encrypted_message, salt, iv
|
||||
|
||||
|
||||
protocol = "ZMQ"
|
||||
protocol = "ZMQ_WS"
|
||||
server_port = ('*', 6980)
|
||||
|
||||
if protocol == "TCP":
|
||||
@ -52,6 +52,11 @@ elif protocol == "ZMQ":
|
||||
context = zmq.Context()
|
||||
s = context.socket(zmq.PUB)
|
||||
s.bind(f"tcp://{server_port[0]}:{server_port[1]}")
|
||||
elif protocol == "ZMQ_WS":
|
||||
context = zmq.Context()
|
||||
s = context.socket(zmq.PUB)
|
||||
s.bind(f"ws://{server_port[0]}:{server_port[1]}")
|
||||
protocol = "ZMQ"
|
||||
else:
|
||||
print(f"{protocol} not supported")
|
||||
exit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user