GithubHelp home page GithubHelp logo

dplusic / gamelift-nodejs-serversdk Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 7.0 70 KB

Unofficial GameLift Server SDK for Node.js

Home Page: https://www.npmjs.com/package/@dplusic/gamelift-nodejs-serversdk

License: Apache License 2.0

TypeScript 13.07% JavaScript 86.93%
aws gamelift nodejs

gamelift-nodejs-serversdk's People

Contributors

dplusic 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gamelift-nodejs-serversdk's Issues

Feature Request: Support for GameLift Anywhere

GameLift Anywhere allows you to provision any machine (like a local dev machine) to be a part of a fleet. More info here: https://aws.amazon.com/blogs/aws/introducing-amazon-gamelift-anywhere-run-your-game-servers-on-your-own-infrastructure/

The main change required for GameLift-Nodejs-ServerSDK to be compatible with GameLift Anywhere would be the addition of a ServerParameters argument in InitSdk. More info via the GameLift Docs:

To initialize a server process on a Amazon GameLift Anywhere compute resource, call InitSdk() with the following ServerParameters:

  • The URL of the websocket used to connect to your game server.
  • The ID of the process used to host your game server.
  • The ID of the compute hosting your game server processes.
  • The ID of the GameLift fleet containing your Amazon GameLift Anywhere compute.
  • The authorization token generated by the Amazon GameLift operation GetComputeAuthToken.

I would be happy to implement this if a PR would be accepted.

glue with realtime

Hi,

I'm trying to use your ported sdk with a realtime script so I can test in local.
I'm wondering where I can use AcceptPlayerSession? I can't find any function to listen to incoming clients.
Could you help me? You seem way more advanced than me :)

Unable to parse terminationTime from TerminateProcess message

I know this repo is rather old, just saving this issue here for posterity. I hope I can submit a PR for it some day.

I'm seeing this error on live servers in GameLift:

2023-05-03T18:57:05.064Z engine.io-client:socket socket receive: type "message", data "2["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"]"
2023-05-03T18:57:05.065Z socket.io-parser decoded 2["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"] as {"type":2,"nsp":"/","data":["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"]}
2023-05-03T18:57:05.067Z socket.io-client:socket emitting event ["TerminateProcess","{\n  \"terminationTime\": \"1683140584\"\n}"]
2023-05-03T18:57:05.068Z ServerState ServerState got the terminateProcess signal.  rawTerminationTime : {
  "terminationTime": "1683140584"
}
2023-05-03 11:57:05.070 INFO  GameLift: Process is exiting with code 1. Calling GameLiftServerAPI.Destroy() 
2023-05-03 11:57:05.071 INFO  GameLift: Disposing of GameLift 
2023-05-03 11:57:05.074 INFO  /local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:308
        this.terminationTime = deserialized.terminationTime.mul(1000 * 10000)
                                                            ^
2023-05-03 11:57:05.077 INFO  TypeError: deserialized.terminationTime.mul is not a function
    at ServerState.<anonymous> (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:308:61)
    at step (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:32:23)
    at Object.next (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:13:53)
    at /local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/dist/lib/Server/ServerState.js:3:12)
    at /local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:293:7
    at ServerState.OnTerminateProcess (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/ServerState.ts:312:7)
    at Socket.<anonymous> (/local/game/server/node_modules/@dplusic/gamelift-nodejs-serversdk/src/Server/Network.ts:61:20)
    at Socket.Emitter.emit (/local/game/server/node_modules/component-emitter/index.js:145:20)

It appears that terminationTime is assumed to be a Long at this point. I'm not sure what the value actually is, but there could be some additional checks / conversions to avoid this error

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.