Beispiel #1
0
def onconnect():
    emit('locations', get_locations())
    dispatcher.subscribe('time', request.sid)
    dispatcher.subscribe('matchings', request.sid)
    dispatcher.dispatch('time', date_to_iso(env.now))
    dispatcher.dispatch('matchings', serialize_matchings(get_matchings()))
    print("Client connected")
Beispiel #2
0
def subscribe(service_dict):
    service = get_service_key(service_dict)
    matchings = get_matchings()

    segments = []

    if service in matchings:
        unit_matchings_diff = matchings[service]
        segments = segment.from_matchings_diff_serialized(service, unit_matchings_diff)

    dispatcher.subscribe(service, request.sid)
    dispatcher.dispatch_service(service, segments)