Giter Site home page Giter Site logo

nodesdk's Introduction

nodesdk's People

Contributors

bvanous avatar dependabot[bot] avatar ehgoodenough avatar frugality avatar hungwunfai avatar jeremy-playfab avatar marcowilliamspf avatar marcusball avatar matt-augustine avatar nwhitmont avatar pgilmorepf avatar playfabjenkinsbot avatar sivakatir avatar toddbellmsft avatar zac-playfab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodesdk's Issues

Is there a way to use the Client SDK in a stateless manner?

Right now, when loggin in, for example using LoginWithPlayFab, the client SDK mutates the global state of the SDK by setting _internalSettings:

if (result.data.SessionTicket != null) {
  PlayFab._internalSettings.sessionTicket = result.data.SessionTicket;
}
if (result.data.EntityToken != null) {
  PlayFab._internalSettings.entityToken = result.data.EntityToken.EntityToken;
}

I am sure this makes sense in the context of a game client, but for a server-side node js SDK, this does not really make sense, because there will be multiple clients sharing the same state (connecting to the same server).

Is their a recipie for how to handle this usecase?

Thanks.

[Question] Should the IPlayFabResultCommon interface extend the IPlayFabError interface?

When stubbing out the PlayFab SDK for testing, the callback type needs an object that conforms to this interface:

    export interface IPlayFabSuccessContainer<TResult extends IPlayFabResultCommon> extends IPlayFabError {
        data: TResult;
    }

but IPlayFabResultCommon also extends IPlayFabError. So while I think I should be able to use an object that looks like this:

{
  code: 200,
  status: 'OK',
  error: '',
  errorCode: 0,
  errorMessage: ''
  data: {
    Data: {}
  }
}

I'm having to build an object that looks like this in order to get Typescript to allow it as a parameter to the ApiCallback function:

{
  code: 200,
  status: 'OK',
  error: '',
  errorCode: 0,
  errorMessage: ''
  data: {
    code: 200,
    status: 'OK'
    error: '',
    errorCode: 0,
    errorMessage: '',
    Data: {}
  }
}

Also, shouldn't the error, errorCode, and errorMessage properties be optional? Those are not returned when the call is successful.

Do not throw strings

In a lot of places you use throw 'string' this makes it hard to trace errors, please consider replacing these with throw new Error('string');

Latest package does not include root imports.

The latest package version made some changes to the package.json file. It now only includes scripts from within the Scripts directory. This breaks any code that made use of:

const pf = require("playfab-sdk");

[Question] How to set entityToken and SessionTicket in PlayFab SDK?

I 'm currently working with playfab-sdk , and I got the entityToken and SessionTicket after login but I cannot find method to set it on _internalSettings in playfabClient :
var _internalSettings = (exports._internalSettings = {
entityToken: null,
sessionTicket: null,
requestGetParams: {
sdk: "JavaScriptSDK-2.123.230403",
},
});

Thanks in advance!

PlayerProfileViewConstraints typings: Variables with default value marked as required

In the class PlayerProfileViewConstraints all values are marked as required, even though it says "Defaults to X". This causes some typescript issues where we have to type out all the variables. I suspect it might be the case for other classes as well.

export interface PlayerProfileViewConstraints {

Great product, keep up the good work!

Cannot find module 'playfab-sdk/PlayFab' - supposed architectural problem

I think the documentation is incorrect, and possibly there's also some problems in the architecture of the plugin as a node module.

  • Requiring PlayFab as per documentation
    var PlayFab = require("playfab-sdk/PlayFab");
    doesn't work:
    Error: Cannot find module 'playfab-sdk/PlayFab'

Looking through the code, I suppose we should get a reference to the PlayFab object (and eventually any other PlayFab specific object) from main.js, which is where they're instantiated.
I managed to do so by exporting everything in main.js:
module.exports = { PlayFab: PlayFab, PlayFabAdmin: PlayFabAdmin, PlayFabMatchmaker: PlayFabMatchmaker, PlayFabClient: PlayFabClient, PlayFabServer: PlayFabServer }

and importing the corresponding objects:
var PlayFabRoot = require("playfab-sdk"); var PlayFab = PlayFabRoot.PlayFab; var PlayFabServer = PlayFabRoot.PlayFabServer;

  • I think it's also wrong to suggest referencing to multiple PlayFab objects with multiple requires: since the object are stateful you're not getting the same singleton everytime, so, for example, the PlayFab object instance inside PlayFabServer is not the same you would get requiring it in the application code. This should work only if the library code is not a npm module: have you actually tested using the sdk as a npm module?

Do not ship redundant files

This is just a minor issue.
Please consider updating your .npmignore to only ship files that are needed.
You can omit documentation, tests and build scripts, btw. .npmignore is never shipped by default.

[Question] How to remove session token from PlayFabClient?

I want to implement a logout feature in my game client, where the SessionToken is cleared from the program and the user would return to the login page. However, I can't seem to find in the documentation for this SDK anything on how to clear stored credentials from the client without needing to exit the program entirely.

It seems that the C# SDK has a ForgetAllCredentials() function that does this task. Is there an equivalent on the NodeJS SDK?

Setting EntityToken manually to request multiplayer server

Hi! I am currently working on our custom matchmaking mechanism using die NodeSDK. One part of it is to request the multiplayer server once matched using PlayFabMultiplayer.RequestMultiplayerServer(). For our game we are already using the MultiplayerServerSecureWebsocket software, where that functionalityis implemented. Unfortunately I cannot recreate the code in the NodeSDK, as I cannot seem to find out to set the entity token as done here. Without it that, the request fails with error 1335 EntityTokenInvalid.

Is that the right approach or should I use a different way? If it is the right approach, how do I set the entity token as in the C# client?

Thanks in advance!

Update typings to new standards

declare module ModuleName is somewhat deprecated and does require additional setup, having 1 main typings files (see https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) makes it much easier to consume this library, please consider updating accordingly.

Ideally you would have 1 index.d.ts files which then re-exports all the modules, the TS docs explain these things quiet well.
This also allows proper importing via the import keyword and makes a much better user experience.

Linting error: index.d.ts on Value

Looks like a type declaration is needed on line 17. I am unsure what it should be, currently it only auto resolves to type any for me.
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.