示例#1
0
文件: Bridge.py 项目: ramanraja/Home5
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))
示例#2
0
文件: Bridge.py 项目: ramanraja/Home6
def ping_socket():
    print('\nPinging socket...')
    socketio.send('Ping!')  # broadcast=True is implied
    return ({'result': True, 'msg': 'Ping sent to socket client'})