{"id":26751711,"url":"https://github.com/dplusic/gamelift-nodejs-serversdk","last_synced_at":"2025-04-15T00:32:26.037Z","repository":{"id":45766020,"uuid":"134066822","full_name":"dplusic/GameLift-Nodejs-ServerSDK","owner":"dplusic","description":"Unofficial GameLift Server SDK for Node.js","archived":false,"fork":false,"pushed_at":"2018-12-27T15:44:28.000Z","size":70,"stargazers_count":25,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T12:33:43.969Z","etag":null,"topics":["aws","gamelift","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@dplusic/gamelift-nodejs-serversdk","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dplusic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-19T14:00:26.000Z","updated_at":"2023-10-01T23:27:55.000Z","dependencies_parsed_at":"2022-09-02T12:01:46.585Z","dependency_job_id":null,"html_url":"https://github.com/dplusic/GameLift-Nodejs-ServerSDK","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dplusic%2FGameLift-Nodejs-ServerSDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dplusic%2FGameLift-Nodejs-ServerSDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dplusic%2FGameLift-Nodejs-ServerSDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dplusic%2FGameLift-Nodejs-ServerSDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dplusic","download_url":"https://codeload.github.com/dplusic/GameLift-Nodejs-ServerSDK/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248984674,"owners_count":21193795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","gamelift","nodejs"],"created_at":"2025-03-28T12:27:03.116Z","updated_at":"2025-04-15T00:32:26.018Z","avatar_url":"https://github.com/dplusic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GameLift-Nodejs-ServerSDK\nUnofficial GameLift Server SDK for Node.js\n(A port of GameLift-CSharp-ServerSDK)\n\n## Example Code\n\n```javascript\n//This is an example of a simple integration with GameLift server SDK that will make game server processes go active on GameLift!\n\nconst exitHook = require('exit-hook');\nconst { 'default': GameLiftServerAPI, ProcessParameters, LogParameters } = require('gamelift-nodejs-serversdk')\n\nexitHook(() =\u003e {\n\tGameLiftServerAPI.Destroy()\n});\n\nconst listeningPort = 7777;\n\n//InitSDK will establish a local connection with GameLift's agent to enable further communication.\nconst initSDKOutcome = GameLiftServerAPI.InitSDK()\nif (initSDKOutcome.Success) {\n  const processParameters = new ProcessParameters(\n    (gameSession) =\u003e {\n      //When a game session is created, GameLift sends an activation request to the game server and passes along the game session object containing game properties and other settings.\n      //Here is where a game server should take action based on the game session object.\n      //Once the game server is ready to receive incoming player connections, it should invoke GameLiftServerAPI.ActivateGameSession()\n      GameLiftServerAPI.ActivateGameSession();\n    },\n    (updateGameSession) =\u003e {\n      //When a game session is updated (e.g. by FlexMatch backfill), GameLiftsends a request to the game\n      //server containing the updated game session object.  The game server can then examine the provided\n      //matchmakerData and handle new incoming players appropriately.\n      //updateReason is the reason this update is being supplied.\n    },\n    () =\u003e {\n      //OnProcessTerminate callback. GameLift will invoke this callback before shutting down an instance hosting this game server.\n      //It gives this game server a chance to save its state, communicate with services, etc., before being shut down.\n      //In this case, we simply tell GameLift we are indeed going to shutdown.\n      GameLiftServerAPI.ProcessEnding();\n    }, \n    () =\u003e {\n      //This is the HealthCheck callback.\n      //GameLift will invoke this callback every 60 seconds or so.\n      //Here, a game server might want to check the health of dependencies and such.\n      //Simply return true if healthy, false otherwise.\n      //The game server has 60 seconds to respond with its health status. GameLift will default to 'false' if the game server doesn't respond in time.\n      //In this case, we're always healthy!\n      return true;\n    },\n    listeningPort, //This game server tells GameLift that it will listen on port 7777 for incoming player connections.\n    new LogParameters([\n      //Here, the game server tells GameLift what set of files to upload when the game session ends.\n      //GameLift will upload everything specified here for the developers to fetch later.\n      '/local/game/logs/myserver.log'\n    ]));\n\n  (async () =\u003e {\n    try {\n      //Calling ProcessReady tells GameLift this game server is ready to receive incoming game sessions!\n      const processReadyOutcome = await GameLiftServerAPI.ProcessReady(processParameters);\n      if (processReadyOutcome.Success)\n      {\n        console.log(\"ProcessReady success.\");\n      }\n      else\n      {\n        console.log(\"ProcessReady failure : \" + processReadyOutcome.Error.toString());\n      }\n    } catch (e) {\n      console.log(e);\n    }\n  })()\n} else {\n  console.log(\"InitSDK failure : \" + initSDKOutcome.Error.toString());\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdplusic%2Fgamelift-nodejs-serversdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdplusic%2Fgamelift-nodejs-serversdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdplusic%2Fgamelift-nodejs-serversdk/lists"}