Get neturl to global namespace

This commit is contained in:
Vivek Teega 2020-10-10 04:34:00 +05:30
parent 2ea0996e26
commit 94c35cd593

View File

@ -2332,7 +2332,7 @@ def switchNeturl(neturl):
return testserverlist[neturlindex+1] return testserverlist[neturlindex+1]
def reconnectSSE(neturl): def reconnectSSE(websocketApi):
# Switch a to different flosight # Switch a to different flosight
# neturl = switchNeturl(neturl) # neturl = switchNeturl(neturl)
# Connect to Flosight websocket to get data on new incoming blocks # Connect to Flosight websocket to get data on new incoming blocks
@ -2342,18 +2342,18 @@ def reconnectSSE(neturl):
scanBlockchain() scanBlockchain()
logger.debug("Rescan completed") logger.debug("Rescan completed")
try: try:
logger.debug(f"Attempting websocket connection to {neturl}") logger.debug(f"Attempting websocket connection to {websocketApi}")
sio.connect(neturl + "socket.io/socket.io.js") sio.connect(websocketApi + "socket.io/socket.io.js")
connection_status = True connection_status = True
return neturl return websocketApi
except: except:
logger.debug(f"Could not connect to the websocket endpoint {neturl}") logger.debug(f"Could not connect to the websocket endpoint {websocketApi}")
neturl = switchNeturl(neturl) websocketApi = switchNeturl(websocketApi)
# At this point the script has updated to the latest block # At this point the script has updated to the latest block
# Now we connect to flosight's websocket API to get information about the latest blocks # Now we connect to flosight's websocket API to get information about the latest blocks
neturl = 'https://flosight.duckdns.org/' # Neturl is the URL for Flosight API whose websocket endpoint is being connected to global neturl = 'https://flosight.duckdns.org/' # Neturl is the URL for Flosight API whose websocket endpoint is being connected to
sio = socketio.Client(reconnection=False) sio = socketio.Client(reconnection=False)
# Connect to the websocket endpoint and return the new neturl # Connect to the websocket endpoint and return the new neturl