{"id":25940712,"url":"https://github.com/2003scape/rsc-socket","last_synced_at":"2025-03-04T05:18:37.006Z","repository":{"id":57093508,"uuid":"302100342","full_name":"2003scape/rsc-socket","owner":"2003scape","description":"🔌 encode/decode runescape classic packets","archived":false,"fork":false,"pushed_at":"2020-12-15T00:05:14.000Z","size":46,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T19:17:03.013Z","etag":null,"topics":["game-networking","mmorpg","network","packet","packets","protocol","rsc","rsps","runescape","socket"],"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":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-07T16:45:24.000Z","updated_at":"2025-02-04T22:40:33.000Z","dependencies_parsed_at":"2022-08-22T21:40:17.471Z","dependency_job_id":null,"html_url":"https://github.com/2003scape/rsc-socket","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-socket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-socket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-socket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-socket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2003scape","download_url":"https://codeload.github.com/2003scape/rsc-socket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241787657,"owners_count":20020133,"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":["game-networking","mmorpg","network","packet","packets","protocol","rsc","rsps","runescape","socket"],"created_at":"2025-03-04T05:18:36.590Z","updated_at":"2025-03-04T05:18:36.999Z","avatar_url":"https://github.com/2003scape.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rsc-socket\nencode/decode runescape classic packets. designed to wrap\nnode [Socket](https://nodejs.org/api/net.html#net_class_net_socket) or\nWebSocket ([client](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)\nor [server](https://www.npmjs.com/package/ws)), similar to how\n[json-socket](https://www.npmjs.com/package/json-socket) works.\n\nthis module handles encoding/decoding of usernames and chat messages as well,\nconverting everything to native types.\n\n## install\n\n    $ npm install @2003scape/rsc-socket\n\n## example\n```javascript\nconst RSCSocket = require('./src');\nconst net = require('net');\n\nnet.createServer((socket) =\u003e {\n    socket = new RSCSocket(socket, true);\n    socket.on('error', (err) =\u003e console.error(err));\n\n    socket.on('message', (message) =\u003e {\n        console.log('packet recevied', message);\n\n        if (message.type === 'login') {\n            socket.sendMessage({\n                type: 'worldInfo',\n                index: 0,\n                planeWidth: 2304,\n                planeHeight: 1776,\n                planeIndex: 0\n            });\n        }\n    });\n}).listen(43594);\n```\n\n## api\n### socket = new RSCSocket(net.Socket || WebSocket, isServer = true)\ncreate a new socket wrapper instance.\n\n### socket.send(data)\nsend a raw data buffer (used in login process).\n\n### socket.sendMessage(message)\nsend a POJO from to be encoded and written to the socket.\n\n### socket.getIPAddress()\nreturn the IPv4 address as a string.\n\n### socket.close()\nterminate or destroy the socket.\n\n### socket.on('message', (message) =\u003e {})\nreceived a decoded packet POJO.\n\n## license\nCopyright 2020  2003Scape Team\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the\nFree Software Foundation, either version 3 of the License, or (at your option)\nany later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along\nwith this program. If not, see http://www.gnu.org/licenses/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2003scape%2Frsc-socket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2003scape%2Frsc-socket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2003scape%2Frsc-socket/lists"}