Fix websockets not sending data

This commit is contained in:
Mashintime 2023-11-23 01:01:29 -05:00
parent a5ebf2d0fc
commit 28e7694545
2 changed files with 7 additions and 2 deletions

View file

@ -184,7 +184,7 @@ def post_modem_stop():
@app.route('/version', methods=['GET'])
def get_modem_version():
return api_response({"version": 0})
return api_response({"version": app.MODEM_VERSION})
@app.route('/modem/send_arq_raw', methods=['POST'])
def post_modem_send_raw():
@ -218,8 +218,13 @@ def sock_events(sock):
@sock.route('/fft')
def sock_fft(sock):
if len(wsm.fft_client_list) == 0:
app.modem_service.put("fft:true")
print("Streaming data to FFT socket since a client is connected")
wsm.handle_connection(sock, wsm.fft_client_list, app.modem_fft)
@sock.route('/states')
def sock_states(sock):
wsm.handle_connection(sock, wsm.states_client_list, app.state_queue)
wsm.startThreads(app)

View file

@ -41,7 +41,7 @@ def transmit_sock_data_worker(client_list, event_queue):
client_list.remove(client)
# start a worker thread for every socket endpoint
def startThreads(events_worker, d):
def startThreads(app):
events_thread = threading.Thread(target=transmit_sock_data_worker, daemon=True, args=(events_client_list, app.modem_events))
events_thread.start()