playfab / nodesdk Goto Github PK
View Code? Open in Web Editor NEWPlayfab SDK for node.js applications
License: Apache License 2.0
Playfab SDK for node.js applications
License: Apache License 2.0
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.
Great product, keep up the good work!
The LoginWithGoogleAccountRequest
object for PlayFabClient.LoginWithGoogleAccount
API call is missing accessToken
param that is needed to login.
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');
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!
It doesn't look like the SDK supports async/await. Is this something you intend to change?
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?
I think the documentation is incorrect, and possibly there's also some problems in the architecture of the plugin as a node module.
var PlayFab = require("playfab-sdk/PlayFab");
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;
According to the docs, this property should be an object with one of the following values.
Not sure if this is an auto-generated file, or someone is managing it, but would be nice to get it updated somehow.
Something like https://www.npmjs.com/package/playfab? :D
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.
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.
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!
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.
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.
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");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.