{"id":23200900,"url":"https://github.com/naokikimura/msgpack-rpc-lite","last_synced_at":"2025-06-15T07:33:18.147Z","repository":{"id":38955464,"uuid":"120982957","full_name":"naokikimura/msgpack-rpc-lite","owner":"naokikimura","description":"Implementation of MessagePack-RPC with msgpack-lite","archived":false,"fork":false,"pushed_at":"2022-12-07T17:52:37.000Z","size":242,"stargazers_count":5,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-29T01:19:22.100Z","etag":null,"topics":["messagepack","messagepack-rpc","msgpack","msgpack-lite","msgpack-rpc","msgpackrpc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naokikimura.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-02-10T04:10:05.000Z","updated_at":"2024-06-03T23:46:46.000Z","dependencies_parsed_at":"2023-01-24T19:33:56.872Z","dependency_job_id":null,"html_url":"https://github.com/naokikimura/msgpack-rpc-lite","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naokikimura%2Fmsgpack-rpc-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naokikimura%2Fmsgpack-rpc-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naokikimura%2Fmsgpack-rpc-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naokikimura%2Fmsgpack-rpc-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naokikimura","download_url":"https://codeload.github.com/naokikimura/msgpack-rpc-lite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230292743,"owners_count":18203649,"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":["messagepack","messagepack-rpc","msgpack","msgpack-lite","msgpack-rpc","msgpackrpc"],"created_at":"2024-12-18T15:13:07.790Z","updated_at":"2024-12-18T15:13:08.475Z","avatar_url":"https://github.com/naokikimura.png","language":"TypeScript","readme":"# msgpack-rpc-lite\n\n[![npm version](https://badge.fury.io/js/msgpack-rpc-lite.svg)](https://badge.fury.io/js/msgpack-rpc-lite)\n[![Build Status](https://travis-ci.org/naokikimura/msgpack-rpc-lite.svg?branch=master)](https://travis-ci.org/naokikimura/msgpack-rpc-lite)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/85c5e44e31da475ebcaae8f1b79de7c8)](https://app.codacy.com/app/n.kimura.cap/msgpack-rpc-lite?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=naokikimura/msgpack-rpc-lite\u0026utm_campaign=badger)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/5a32022009694006ab61191e243e569f)](https://www.codacy.com/app/n.kimura.cap/msgpack-rpc-lite?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=naokikimura/msgpack-rpc-lite\u0026utm_campaign=Badge_Coverage)\n[![codecov](https://codecov.io/gh/naokikimura/msgpack-rpc-lite/branch/master/graph/badge.svg)](https://codecov.io/gh/naokikimura/msgpack-rpc-lite)\n[![Known Vulnerabilities](https://snyk.io/test/github/naokikimura/msgpack-rpc-lite/badge.svg?targetFile=package.json)](https://snyk.io/test/github/naokikimura/msgpack-rpc-lite?targetFile=package.json)\n\nImplementation of MessagePack-RPC with msgpack-lite\n\n## Usage ##\n\n- __createServer([*serverOptions*][, *codecOptions*])__\n\n    Creates a new MessagePack-RPC server.\n\n    - `serverOptions` \u0026lt;Object\u003e See [net.createServer([options][, connectionListener])](https://nodejs.org/api/net.html#net_net_createserver_options_connectionlistener)\n    - `codecOptions` \u0026lt;Object\u003e\n        - `encode` See [Custom Codec Options][1]\n        - `decode` See [Custom Codec Options][1]\n    - Returns: \u0026lt;net.Server\u003e\n\n- __Server event: *method*__\n\n    Emitted when a new connection is made.\n\n    - \u0026lt;Array\u003e request parameters.\n    - \u0026lt;Function\u003e If a request is received, a callback function is passed.\n        - To return the results to the client, pass `null` as the first argument and response parameters as the second argument.\n        - If an error occurs, pass it to the first argument.\n\n- __createClient(*port*[, *host*][, *timeout*][, *codecOptions*])__\n\n    Initiates a MessagePack-RPC client.\n\n    - `port` \u0026lt;number\u003e Port the socket should connect to.\n    - `host` \u0026lt;string\u003e Host the socket should connect to. Default: `'localhost'`\n    - `timeout` \u0026lt;number\u003e Sets the socket to timeout after timeout milliseconds of inactivity on the socket. If timeout is 0, then the existing idle timeout is disabled. Default: `0`\n    - `codecOptions` \u0026lt;Object\u003e\n        - `encode` See [Custom Codec Options][1]\n        - `decode` See [Custom Codec Options][1]\n    - Return: \u0026lt;Client\u003e\n\n- __client.request(*method*[, *...args*])__\n\n    - `method` \u0026lt;string\u003e\n    - Return: \u0026lt;Promise\u003e\n\n- __client.notify(*method*[, *...args*])__\n\n    - `method` \u0026lt;string\u003e\n    - Return: \u0026lt;Promise\u003e\n\n[1]: https://github.com/kawanet/msgpack-lite#custom-codec-options\n\n## Examples ##\n\n- Server\n    ```js\n    const rpc = require('msgpack-rpc-lite');\n    const server = rpc.createServer().on('say', (params, callback) =\u003e {\n        const [ message ] = params; \n        callback(null, `hello ${ message }`);\n    });\n    server.listen(9199);\n    ```\n\n- Client\n    ```js\n    const rpc = require('msgpack-rpc-lite');\n\n    const client = rpc.createClient(9199, 'localhost');\n    client.request('say', [ 'world' ]).then(([ response ]) =\u003e {\n        console.log(response); // hello world\n    })\n    ```\n\n## Compatibility Mode ##\n\nSet `true` to `useraw` of `encode`/`decode` of Codec-options.\n\n- Client\n    ```js\n    const codecOptions = { encode: { useraw: true }, decode: { useraw: true } };\n\n    const client = rpc.createClient(9199, 'localhost', 0, codecOptions);\n    ```\n\nSee also:\n- https://github.com/kawanet/msgpack-lite#compatibility-mode\n- https://github.com/msgpack/msgpack/blob/master/spec.md#upgrading-messagepack-specification\n\n## See also ##\n\n- [MessagePack-RPC Specification](https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md)\n- http://frsyuki.hatenablog.com/entry/20100406/p1\n- [MessagePack specification](https://github.com/msgpack/msgpack/blob/master/spec.md)\n- [msgpack-lite](https://github.com/kawanet/msgpack-lite)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaokikimura%2Fmsgpack-rpc-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaokikimura%2Fmsgpack-rpc-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaokikimura%2Fmsgpack-rpc-lite/lists"}