question

brendan avatar image
brendan asked

Unity SDK sync request

ishadowfax
started a topic on Wed, 08 April 2015 at 9:33 AM

I have a dedicated server with a callback OnConnectionValidate() When I try to validate user ticket in this server callback with RedeemMarchplayerTicket() it is called asynchronous and makes me know if the ticket is walid or not only in it's callback function. But I need to access my ticket validation statate in my server OnConnectionValidate() callback. How can I achieve that?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

For developers working on a language that does not support closures, we've updated all the SDKs to provide a customData field which is returned as part of the response data to any call. You can use that customData to add some specific info about the call, to simplify the process of knowing for which call you made it is the response.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Fri, 10 April 2015 at 10:24 AM

Thanks - knowing that you're working in C#/Unity makes this much simpler. In that language, the intent is that the calls take place in closures, so that the context is available. But that said, we do appreciate the simplicity that having additional info would provide. I'm adding a work item to add a parameter to calls, so that you can pass in context information which you'll get back on the response call, and to also provide the original request, as well. If you can think of a design pattern that this wouldn't cover, feel free to let us know - happy to listen to suggestions and feedback, as always!

Brendan


9 Comments
Brendan Vanous said on Wed, 08 April 2015 at 4:56 PM

Ticket validation is a very simple operation in our service, so there aren't distinct stages to it. Since a query to check the status would likely take the same amount of time as the validation call, the simplest thing to do would be to have a check in your code for whether the callback has been triggered for the request.

Brendan


ishadowfax said on Wed, 08 April 2015 at 11:18 PM

The only way is a global variable? I think that this is not the only case , all your sdk has the same pattern of request->callback, what if I need to query a large amount of data from a catalog for example? Could you please give an example of unity code to use the SDK request and how correctly process it ? Other Similar SDK that work for example with databases have an ability to use WaitForCompletion() or similar methods


ishadowfax said on Thu, 09 April 2015 at 1:16 AM

void uLink.Network.uLink_OnPlayerApproval(uLink.NetworkPlayerApproval approval){
        string ticket = approval.loginData.Read<string> ();

        PlayFabServerAPI.RedeemMatchmakerTicket (new RedeemMatchmakerTicketRequest{
            LobbyId = GameID,
            Ticket = ticket
        }, OnTicketRedeemed, null);

if(???????) approval.Approve(); // here is the problem

    }

    void OnTicketRedeemed (RedeemMatchmakerTicketResult result)
    {
        if (result.TicketIsValid) {
                           ????????
        }
    }

ishadowfax said on Fri, 10 April 2015 at 1:40 AM

Any help here?


Brendan Vanous said on Fri, 10 April 2015 at 10:24 AM

Thanks - knowing that you're working in C#/Unity makes this much simpler. In that language, the intent is that the calls take place in closures, so that the context is available. But that said, we do appreciate the simplicity that having additional info would provide. I'm adding a work item to add a parameter to calls, so that you can pass in context information which you'll get back on the response call, and to also provide the original request, as well. If you can think of a design pattern that this wouldn't cover, feel free to let us know - happy to listen to suggestions and feedback, as always!

Brendan


ishadowfax said on Sun, 12 April 2015 at 11:57 PM

Thank you, how long is to implement such a functionality from PlayFab's team side?


Brendan Vanous said on Mon, 13 April 2015 at 4:59 PM

I've added this in our backlog, but our scheduling is based on the aggregate need of our development community. Because we've received very few requests for this, it may be a while before we can manage to slip this into the schedule. We'll update this thread when this has been implemented. If you'd like to talk through your key integration dates privately, please feel free to email us at devrel@playfab.com.


ishadowfax said on Tue, 09 June 2015 at 1:08 AM

Any updates?


Brendan Vanous said on Tue, 09 June 2015 at 1:18 AM

This continues to be on our backlog. Our prioritization is based in part upon the aggregate needs of our development community. It's very possible, given the small number of requests for this, that most developers are using Closures for this, which would work to maintain all the necessary context information for the calls. That said, we'll continue to track this item, and work to prioritize it appropriately.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.