def on_socket_connect (): global client_count client_count = client_count +1 msg = 'A socket client connected. Client count: {}'.format(client_count) print ('\n **', msg) try: socketio.send (msg) if SIMULATION_MODE: send_simul_status() # start new clients in the correct initial status else: send_tracer_broadcast() # get initial button status for display except Exception as e: print ('* EXCEPTION 4: ', str(e))
def ping_socket(): print('\nPinging socket...') socketio.send('Ping!') # broadcast=True is implied return ({'result': True, 'msg': 'Ping sent to socket client'})