Esempio n. 1
0
    private Task handle_events(EventBase ev)
    {
        switch (ev.EventCase)
        {
        case EventBase.EventOneofCase.SubscriptionSuccessful:
            var session_id_str = ev.SubscriptionSuccessful.SessionToken;
            if (!Guid.TryParse(session_id_str, out session_token))
            {
                throw new Exception("Could not parse the session token received from server!");
            }
            MainThreadEventQueue.Enqueue(() => OnSuccessfulSubscription(session_token));
            if (metadata != null)
            {
                Debug.LogError("Subscriptionsuccessful is received multiple times!");
            }
            var local_metadata = new Metadata();     //Local first because of thread concurrency
            GrpcHeaders.AddSessionToken(local_metadata, session_token);
            metadata = local_metadata;
            break;

        case EventBase.EventOneofCase.None:
            Debug.Log("Got none event.");
            break;
        }

        return(null);
    }
Esempio n. 2
0
 public MatchMakingClientLL(Channel channel, Guid session_token) : base(channel)
 {
     client   = new MatchMakerServiceClient(channel);
     metadata = new Metadata();
     GrpcHeaders.AddSessionToken(metadata, session_token);
 }