{"id":25940715,"url":"https://github.com/2003scape/rsc-data-server","last_synced_at":"2025-03-04T05:18:37.979Z","repository":{"id":36184300,"uuid":"213519875","full_name":"2003scape/rsc-data-server","owner":"2003scape","description":"📊 manage rsc-server worlds, player persistence, friends, etc. (login server)","archived":false,"fork":false,"pushed_at":"2022-03-28T21:57:20.000Z","size":1338,"stargazers_count":12,"open_issues_count":2,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T23:03:54.259Z","etag":null,"topics":["database","emulator","json","rsc","rsps","runescape","runescape-server-emulator","server-emulator","sql","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2003scape.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":"2019-10-08T01:19:14.000Z","updated_at":"2023-10-08T06:03:07.000Z","dependencies_parsed_at":"2022-08-08T13:33:20.454Z","dependency_job_id":null,"html_url":"https://github.com/2003scape/rsc-data-server","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/2003scape%2Frsc-data-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-data-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-data-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-data-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2003scape","download_url":"https://codeload.github.com/2003scape/rsc-data-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241787663,"owners_count":20020135,"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":["database","emulator","json","rsc","rsps","runescape","runescape-server-emulator","server-emulator","sql","sqlite","sqlite3"],"created_at":"2025-03-04T05:18:37.439Z","updated_at":"2025-03-04T05:18:37.970Z","avatar_url":"https://github.com/2003scape.png","language":"JavaScript","readme":"# rsc-data-server\nmanage [rsc-server](https://github.com/2003scape/rsc-server) worlds,\nplayer storage, friend communication, etc. jagex refered to theirs as the\nloginserver.  this server uses [JSON](https://www.npmjs.com/package/json-socket)\nto communicate with rsc-server over TCP or\n[UNIX file sockets for IPC](https://en.wikipedia.org/wiki/Unix_domain_socket).\n\nfeatures:\n * [sqlite database backend](https://sqlite.org/whentouse.html#serversidedb)\nutilizing [better-sqlite3](https://github.com/JoshuaWise/better-sqlite3)\nwith 100% prepared queries for incredible performance and ACID-compliant\ntransactions with no DBMS setup required\n * simplified [table schemas](/create-tables.sql) with no unnecessary JOINs and\nutilization of [sqlite's native json support](https://www.sqlite.org/json1.html)\n * multiple world support. connect more than one instance of\n[rsc-server](https://github.com/2003scape/rsc-server) with different world IDs\nfor cross-world player private messaging\n * automatic hiscore rank updating with the ability to immediately fetch and\ncompare player skill ranks on the fly\n * time-throttled logins with secure, bcrypt password storage and automatic\nre-hashing upon `config.passwordHash` modification\n\n## install\n\n    # npm install @2003scape/rsc-data-server # -g for the CLI program\n\n## cli usage\n`-c \u003cconfig-file\u003e` is optional, rsc-data-server will look for *config.json* in\nits own directory first.\n\n```\n$ rsc-data-server -c /etc/rsc-data-server/config.json\n```\n\n## usage\n```javascript\nconst Server = require('@2003scape/rsc-data-server');\nconst fs = require('fs').promises;\n\n(async () =\u003e {\n    const config = JSON.parse(await fs.readFile('./config.json'));\n    const server = new Server(config);\n    await server.init();\n})();\n```\n\n## config.json\n```javascript\n{\n    \"sockFile\": \"/tmp/rsc-data-server.sock\", // unix IPC socket files\n    \"port\": 8001, // optional TCP port\n    \"sqliteFile\": \"./rsc-data-server.sqlite\",\n    // default is \"test\"\n    \"password\": \"$2y$10$wufvP1CJMLYmBHKl2Ah2k.CGQwQV5aUMIcXrPNUfmqJ9ibNhhvFnS\",\n    \"passwordHashRounds\": 12,\n    \"recoveryHashRounds\": 15,\n    \"playersPerIp\": 1\n}\n```\n\n## handlers\nrsc-data-server responds to JSON messages with the `.handler` property set to\nthe following:\n\n### authenticate\nauthenticate rsc-server or rsc-www instance to allow the rest of the handlers\nto be used.\n\n```javascript\n{\n    handler; 'authenticate',\n    password: 'test'\n}\n```\n\nreturns:\n```javascript\n{\n    success: true, // or false\n    error: '' // if success false\n}\n```\n\n### worldConnect\ninitialize an rsc-server for players to login to.\n\n```javascript\n{\n    handler; 'worldConnect',\n    id: 1, // 1-254\n    tcpPort: 43594,\n    websocketPort: 43595,\n    members: false, // or true\n    country: 'CAN' // ISO 3166-1 alpha-3\n}\n```\n\nreturns:\n```javascript\n{\n    success: true, // or false\n    error: '' // if success false\n}\n```\n\n### worldDisconnect\ndisconnect an rsc-server instance. happens automatically if the connection is\ndropped.\n\n```javascript\n{\n    handler: 'worldDisconnect'\n}\n```\n\n### worldGetList\nget a list of worlds.\n\nreturns:\n```javascript\n[\n    {\n        id: 1,\n        members: false,\n        country: 'CAN',\n        online: true,\n        players: 0 // to 1250\n    }\n]\n```\n\n### playerCount\nthe total number of registered players.\n```javascript\n{\n    handler: 'playerCount'\n}\n```\n\n### playerOnlineCount\nthe number of players online in each world.\n```javascript\n{\n    handler: 'playerOnlineCount'\n}\n```\n\n### playerGetWorlds\nreturn world ids (or 0 if offline) for a list of players.\n```javascript\n{\n    handler: 'playerGetWorlds',\n    usernames: ['andrew', 'paul']\n}\n```\n\nreturns:\n```javascript\n{\n    usernameWorlds: {\n        andrew: 1,\n        paul: 2\n    }\n}\n```\n\n### playerRegister\n```javascript\n{\n    handler: 'playerRegister'\n    username: '',\n    password: '',\n    ip: ''\n}\n```\n\nreturns:\n```javascript\n{\n    success: true, // or false\n    code: 0 // used in the client to display error message or indicate success\n}\n```\n\n### playerLogIn\nchecks if a player's credentials are correct and if they're allowed onto the\nworld they're logging into (membership check).\n\n```javascript\n{\n    handler: 'playerLogin',\n    username: '',\n    password: '',\n    ip: ''\n}\n```\n\nreturns:\n```javascript\n{\n    success: true, // or false\n    code: 0 // similar to registration code\n    player: {\n        id: 1,\n        bank: [ { id: 10, amount: 1000 } ],\n        inventory: [ { id: 10, amount: 1000 } ],\n        skills: { attack: { current: 1, experience: 332 } },\n        // etc.\n    } // undefined if invalid credentials\n}\n```\n\n### playerLogOut\nbroadcast a player logout to each world.\n\n```javascript\n{\n    handler: 'playerLogout',\n    username: ''\n}\n```\n\n### playerWorldChange\nused for switching appearance of world (to offline if blocking private chat for\nexample).\n\n```javascript\n{\n    handler: 'playerWorldChange',\n    username: '',\n    world: 1\n}\n```\n\n### playerMessage\nsend a message to a player on another world.\n\n```javascript\n{\n    handler: 'playerMessage',\n    fromUsername: '',\n    toUsername: '',\n    message: ''\n}\n```\n\nreturns:\n```javascript\n{\n    success: true, // or false\n    error: '' // if success false\n}\n```\n\n## senders\nrsc-data-server sends these to certain (or all) clients with the each header\ncorresponding to the `.handler` property:\n\n### playerLoggedIn\nsent to data clients when players login.\n\n```javascript\n{\n    handler: 'playerLoggedIn',\n    username: '',\n    world: 1 // up to 254\n}\n```\n\n### playerLoggedOut\nsent to data clients when players logout.\n\n```javascript\n{\n    handler: 'playerLoggedOut',\n    username: ''\n}\n```\n\n### playerWorldChange\nsent to data clients when players change world appearance.\n\n```javascript\n{\n    handler: 'playerWorldChange',\n    username: '',\n    world: 1\n}\n```\n\n### playerMessage\nsent to the data client corresponding to the the world `toUsername`\nresides in the `playerMessage` handler.\n\n```javascript\n{\n    handler: 'playerMessage',\n    fromUsername: '',\n    toUsername: '',\n    message: ''\n}\n```\n\n## license\nCopyright (C) 2020  2003Scape Team\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as\npublished by the Free Software Foundation, either version 3 of the\nLicense, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program.  If not, see http://www.gnu.org/licenses/.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2003scape%2Frsc-data-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2003scape%2Frsc-data-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2003scape%2Frsc-data-server/lists"}