Skip to content

APIs

68 Topics 274 Posts

Questions specific to particular APIs, libraries, etc.

  • Simple S2S call via nodejs server

    Moved node.js
    2
    0 Votes
    2 Posts
    1k Views
    R
    This seems to be working now, the error is a wee misleading. The code was correct. The URL was incorrect and was changed to (or leave blank): const url = "sharedprod.braincloudservers.com"; ... brainclouds2s.request(global.s2sContext, { service: "group", operation: "SYS_CREATE_GROUP", data: groupData, }); })
  • Limiting number of async matches

    matchmaking async match
    3
    0 Votes
    3 Posts
    1k Views
    Y
    Thank you! I will try that out. Just for anyone else's future reference, I realized you can "log in" as another user using GetSessionForProfile(). So if the other user is offline, you will be able to modify their data (for example, to increment an attribute for number of matches they have). I believe this way, you can also do what JasonL said and TurnShieldOn() for the other user, stopping them from being able to match anymore. Correct me if I'm wrong.
  • How to view users online ?

    friends group
    2
    0 Votes
    2 Posts
    1k Views
    Paul WinterhalderP
    Hi Jose, Sounds like you want to look into our Presence feature. Presence is designed to let users know when their friends are online. You can think of it like the old Xbox Live friends feature - where you can see which of your friends are online - and optionally what they are doing. And Presence uses RTT - so users will be notified in realtime when the presence information of a followed user changes. Presence works with Friends, Groups, and arbitrary lists of users. More details here - http://getbraincloud.com/apidocs/apiref/#capi-presence Hope that helps! Paul.
  • Processing Refunds?

    refunds transaction log
    6
    0 Votes
    6 Posts
    2k Views
    A
    @Paul-Winterhalder It'd be great if we can have this info. +1
  • Recommended way to read Entity data? (Unity, C#)

    unity entity
    3
    0 Votes
    3 Posts
    2k Views
    T
    @Henry-Smith said in Recommended way to read Entity data? (Unity, C#): Sorry to bring back an old thread, but I'm just learning the platform and I thought I'd share my solution to this. First, define a generic class to handle the raw json response data: eg. my Tut1_AddTwoNumbers api returns: {"data":{"response":{"answer":24},"success":true},"status":200} public class Response<T> { public ResponseData<T> data; public int status; } public class ResponseData<T> { public T response; public bool success; } Then for each api call that you have, define a class that contains the fields that are custom to that response. public class Tut1_AddTwoNumbersResponse { public int answer; } Now, you call your function and handle the response like this: public void Tut1_AddTwoNumbers() { string scriptName = "Tut1_AddTwoNumbers"; // Anonymous object to supply the params. var data = new { num1 = 16, num2 = 8 }; var jsonScriptData = JsonWriter.Serialize(data); SuccessCallback successCallback = (response, userdata) => { var responseObject = JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response); //var responseObject = JObject.Parse(response); Debug.Log($"Success The answer is '{responseObject.data.response.answer}' | raw_json={response}"); }; FailureCallback failureCallback = (status, code, error, userdata) => { Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error)); }; // Call the script _bc.ScriptService.RunScript(scriptName, jsonScriptData, successCallback, failureCallback); } this line is the important part: JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response); Hope that helps someone!
  • 0 Votes
    2 Posts
    967 Views
    J
    To limit operations like IncrementExperiencePoints() to cloud code only. This will essentially take away the ability to make these calls from the bare client API. You can see a script that enforces these restrictions here - https://getbraincloud.com/apidocs/cloud-code-central/handy-cloud-code-scripts/restrictclientcalls-script/ Refer to another post below for more strategies you can apply to prevent cheating: https://forums.getbraincloud.com/topic/23/discussion-strategies-to-prevent-cheating-in-tournaments
  • braincloud javascript and edge

    edge javascript
    2
    0 Votes
    2 Posts
    926 Views
    Paul WinterhalderP
    Hi Bigzer, We aren't aware of any issues running our javascript client lib under Edge - and haven't been able to repro your issue. I'm not a javascript guy - but I'm noticing other warnings / errors there - do those also happen in Chrome? Paul.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Unity Room Server

    Moved Solved room server server unity docs docker documentation
    20
    0 Votes
    20 Posts
    7k Views
    C
    @David-St-Louis-0 @Paul-Winterhalder Hi again. I would like to debug my server locally, in Unity. I have the _S2S stuff all hooked up as described in the walk through. But then I tried to do the following (actual numbers redacted) #if UNITY_EDITOR var appId = "00000"; var serverName = "MyServerName"; var secret = "00000000-0000-0000-0000-000000000000"; _lobbyId = "00000:myLobbyTypeId:00"; #else // Load environment variables passed in by brainCloud to our container var appId = Environment.GetEnvironmentVariable("APP_ID"); var serverName = Environment.GetEnvironmentVariable("SERVER_NAME"); var secret = Environment.GetEnvironmentVariable("SERVER_SECRET"); _lobbyId = Environment.GetEnvironmentVariable("LOBBY_ID"); #endif However, I am getting a perpetual error: #S2S S2S Failed: {"packetId":1,"messageResponses":[{"reason_code":40613,"status_message":"Processing exception: Unrecognized lobby: 00000:myLobbyTypeId:00","status":400}]} I even signed up for a Dev+ subscription, just in case that was the problem, per this thread. No luck. How can I test my server code locally, while still planning for the full-on S2S Docker container deployment? Thanks
  • User Entity vs Global Entity Indexed ID

    unity cloudscript entities
    4
    0 Votes
    4 Posts
    2k Views
    Paul WinterhalderP
    Hi Chris, User entities are primarily indexed by profileId + entityType - so the singleton API will scale well no matter how many players you have. That said, if your use case gets more complicated, with say hundreds of entities of a particular type per user (say maybe you are modelling user created towns, that sort of thing) - you could consider using Owned Custom Entities instead. You can define addition, custom indexes for those... keeps those lookups fast and efficient. In addition, if you end up having >1000 Global Entities, you should definitely look at switching to Unowned Custom Entities. Same deal - you can define your own custom indexes... Hope that helps! Paul.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • NodeJS setup question

    Solved unity api
    6
    0 Votes
    6 Posts
    3k Views
    C
    Thanks @Paul-Winterhalder and @David-St-Louis-0 . I'm communicating with our web dev and am passing on the information to him. I'll respond here once I get more information from him. Appreciate the quick replies.
  • lobbyId ?

    Solved ios lobbyid lobby matchmaking
    6
    0 Votes
    6 Posts
    3k Views
    K
    Oh okay, I understand. Yeah I was already trying to use the C++ SDK, and I will also be waiting for the Obj-C one. Thank you!
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Understanding VerifyPurchases for "Non-Consumables"

    Solved non-consumable verifypurchases
    4
    0 Votes
    4 Posts
    2k Views
    Paul WinterhalderP
    Happy to help!
  • Timeouts?

    Solved unity timeout
    4
    0 Votes
    4 Posts
    2k Views
    U
    Thanks guys! I figured it would be ridiculous if I had to do timeout checks and retries myself
  • Unity AddressableAssets

    Solved unity
    4
    0 Votes
    4 Posts
    2k Views
    Paul WinterhalderP
    Follow-up on this... My guys have looked into it, and the way we version our global files isn't compatible with this new feature from Unity. Apologies! (PS - No plans yet for when/if we'll support it. Certainly tons of folks use an external CDN with brainCloud apps though - so the option is still there for you!)
  • Unity basic setup

    Solved unity
    5
    0 Votes
    5 Posts
    2k Views
    Paul WinterhalderP
    Cool to see the forums working! I've marked @Panagiotis-Milios more detailed explanation as the accepted solution, but kudos to you @Chris-Brown for pointing it out, and @Panagiotis-Milios for providing the detailed example. Thanks a bunch!
  • Group system with larger than 50 limit

    Solved unity groups group
    2
    0 Votes
    2 Posts
    1k Views
    Paul WinterhalderP
    Hi Chris, The maximum # of group members is controllable by our support team. Just send a request to our support team, indicating the name and appId of the app, and what you'd like the max to be and why. (A short description of your use cases would be helpful - since we just need to review to see if we think there would be any performance gotchas). We'll do a quick review and hopefully approve! Cheers! Paul.