{"id":13510347,"url":"https://github.com/metarhia/jstp","last_synced_at":"2025-04-09T21:16:47.866Z","repository":{"id":44177698,"uuid":"53201312","full_name":"metarhia/jstp","owner":"metarhia","description":"Fast RPC for browser and Node.js based on TCP, WebSocket, and MDSF","archived":false,"fork":false,"pushed_at":"2022-12-07T17:36:00.000Z","size":5057,"stargazers_count":144,"open_issues_count":26,"forks_count":10,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-09T21:16:42.063Z","etag":null,"topics":["api","client","highload","impress","ipc","javascript","json","json5","jstp","metarhia","node","nodejs","protocol","rpc","serialization","server","soa","socket","tcp","websocket"],"latest_commit_sha":null,"homepage":"https://metarhia.github.io/jstp","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metarhia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-05T12:55:44.000Z","updated_at":"2025-01-22T07:20:47.000Z","dependencies_parsed_at":"2023-01-24T19:33:20.120Z","dependency_job_id":null,"html_url":"https://github.com/metarhia/jstp","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metarhia%2Fjstp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metarhia%2Fjstp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metarhia%2Fjstp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metarhia%2Fjstp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metarhia","download_url":"https://codeload.github.com/metarhia/jstp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111973,"owners_count":21049578,"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":["api","client","highload","impress","ipc","javascript","json","json5","jstp","metarhia","node","nodejs","protocol","rpc","serialization","server","soa","socket","tcp","websocket"],"created_at":"2024-08-01T02:01:35.077Z","updated_at":"2025-04-09T21:16:47.833Z","avatar_url":"https://github.com/metarhia.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","api"],"sub_categories":[],"readme":"\u003c!-- lint ignore --\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/metarhia/jstp\"\u003e\u003cimg\n    src=\"https://cdn.rawgit.com/metarhia/Metarhia/master/Logos/metarhia-logo.svg\"\n    alt=\"Metarhia Logo\"\n    width=\"300\"\n  /\u003e\u003c/a\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://travis-ci.org/metarhia/jstp\"\u003e\u003cimg\n    src=\"https://travis-ci.org/metarhia/jstp.svg?branch=master\"\n    alt=\"Travis CI\"\n  /\u003e\u003c/a\u003e\n  \u003ca href=\"https://ci.appveyor.com/project/metarhia/jstp\"\u003e\u003cimg\n    src=\"https://ci.appveyor.com/api/projects/status/rev863t5a909ltuq/branch/master?svg=true\"\n    alt=\"AppVeyor CI\"\n  /\u003e\u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/metarhia/jstp?branch=master\"\u003e\u003cimg\n    src=\"https://coveralls.io/repos/github/metarhia/jstp/badge.svg?branch=master\"\n    alt=\"Coverage Status\"\n  /\u003e\u003c/a\u003e\n  \u003ca href=\"https://badge.fury.io/js/%40metarhia%2Fjstp\"\u003e\u003cimg\n    src=\"https://badge.fury.io/js/%40metarhia%2Fjstp.svg\"\n    alt=\"NPM Version\"\n  /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@metarhia/jstp\"\u003e\u003cimg\n    src=\"https://img.shields.io/npm/dm/@metarhia/jstp.svg\"\n    alt=\"NPM Downloads/Month\"\n  /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@metarhia/jstp\"\u003e\u003cimg\n    src=\"https://img.shields.io/npm/dt/@metarhia/jstp.svg\"\n    alt=\"NPM Downloads\"\n  /\u003e\u003c/a\u003e\n  \u003ch1\u003eJSTP / JavaScript Transfer Protocol\u003c/h1\u003e\n\u003c/div\u003e\n\nJSTP is an RPC protocol and framework which provides two-way asynchronous data\ntransfer with support of multiple parallel non-blocking interactions that is so\ntransparent that an app may not even distinguish between local async functions\nand remote procedures.\n\nAnd, as a nice bonus, there's a blazing fast [JSON5](https://github.com/json5)\nimplementation bundled in!\n\n**This project is bound by a [Code of Conduct](CODE_OF_CONDUCT.md).**\n\n## Installation\n\nJSTP works in Node.js and web browsers:\n\n```sh\n$ npm install --save @metarhia/jstp\n```\n\nOr, alternatively, there is\n[jstp.umd.js](https://unpkg.com/@metarhia/jstp@latest/dist/jstp.umd.js)\nUMD bundle.\n\nWe also have official client-side implementations for\n[Swift](https://github.com/metarhia/jstp-swift) and\n[Java](https://github.com/metarhia/jstp-java)\nthat work effortlessly on iOS and Android 🎉\n\nThere is also an interactive CLI provided by this package:\n\n```sh\n$ npm install -g @metarhia/jstp\n$ jstp-cli\n```\n\n## Getting Started\n\nServer:\n\n```js\n'use strict';\n\nconst jstp = require('@metarhia/jstp');\n\n// Application is the core high-level abstraction of the framework. An app\n// consists of a number of interfaces, and each interface has its methods.\nconst app = new jstp.Application('testApp', {\n  someService: {\n    sayHi(connection, name, callback) {\n      callback(null, `Hi, ${name}!`);\n    },\n  },\n});\n\n// Let's create a TCP server for this app. Other available transports are\n// WebSocket and Unix domain sockets. One might notice that an array of\n// applications is passed the `createServer()`. That's because it can serve\n// any number of applications.\nconst server = jstp.net.createServer([app]);\nserver.listen(3000, () =\u003e {\n  console.log('TCP server listening on port 3000 🚀');\n});\n```\n\nClient:\n\n```js\n'use strict';\n\nconst jstp = require('@metarhia/jstp');\n\n// Create a TCP connection to server and connect to the `testApp` application.\n// Clients can have applications too for full-duplex RPC,\n// but we don't need that in this example. Client is `null` in this example,\n// this implies that username and password are both `null`\n// here — that is, the protocol-level authentication is not leveraged in this\n// example. The next argument is an array of interfaces to inspect and build\n// remote proxy objects for. Remaining arguments are for\n// net.connect (host and port) and last argument is a callback\n// to be called on successful connection or error.\njstp.net.connectAndInspect(\n  'testApp',\n  null,\n  ['someService'],\n  3000,\n  'localhost',\n  handleConnect\n);\n\nfunction handleConnect(error, connection, app) {\n  if (error) {\n    console.error(`Could not connect to the server: ${error}`);\n    return;\n  }\n\n  // The `app` object contains remote proxy objects for each interface that has\n  // been requested which allow to use remote APIs as regular async functions.\n  // Remote proxies are also `EventEmitter`s: they can be used to `.emit()`\n  // events to another side of a connection and listen to them using `.on()`.\n  app.someService.sayHi('JSTP', (error, message) =\u003e {\n    if (error) {\n      console.error(`Oops, something went wrong: ${error}`);\n      return;\n    }\n    console.log(`Server said \"${message}\" 😲`);\n  });\n}\n```\n\n## Project Maintainers\n\nKudos to [@tshemsedinov](https://github.com/tshemsedinov) for the initial idea\nand proof-of-concept implementation. Current project team is:\n\n- [@aqrln](https://github.com/aqrln) \u0026mdash;\n  **Alexey Orlenko** \u0026lt;eaglexrlnk@gmail.com\u0026gt;\n- [@belochub](https://github.com/belochub) \u0026mdash;\n  **Mykola Bilochub** \u0026lt;nbelochub@gmail.com\u0026gt;\n- [@lundibundi](https://github.com/lundibundi) \u0026mdash;\n  **Denys Otrishko** \u0026lt;shishugi@gmail.com\u0026gt;\n- [@nechaido](https://github.com/nechaido) \u0026mdash;\n  **Dmytro Nechai** \u0026lt;nechaido@gmail.com\u0026gt;\n- [@tshemsedinov](https://github.com/tshemsedinov) \u0026mdash;\n  **Timur Shemsedinov** \u0026lt;timur.shemsedinov@gmail.com\u0026gt;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetarhia%2Fjstp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetarhia%2Fjstp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetarhia%2Fjstp/lists"}