{"id":19340199,"url":"https://github.com/flowbased/fbp-client","last_synced_at":"2025-04-23T02:31:17.461Z","repository":{"id":30799423,"uuid":"126039537","full_name":"flowbased/fbp-client","owner":"flowbased","description":"Higher-level client for communicating with FBP protocol runtimes","archived":false,"fork":false,"pushed_at":"2023-01-09T02:01:02.000Z","size":129,"stargazers_count":9,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-16T13:47:28.145Z","etag":null,"topics":["fbp-protocol"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flowbased.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-20T15:24:58.000Z","updated_at":"2024-05-19T14:28:13.000Z","dependencies_parsed_at":"2023-01-14T17:42:30.447Z","dependency_job_id":null,"html_url":"https://github.com/flowbased/fbp-client","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flowbased","download_url":"https://codeload.github.com/flowbased/fbp-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250357618,"owners_count":21417314,"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":["fbp-protocol"],"created_at":"2024-11-10T03:25:36.689Z","updated_at":"2025-04-23T02:31:17.204Z","avatar_url":"https://github.com/flowbased.png","language":"JavaScript","readme":"fbp-client\n==========\n\nThis library provides a higher level client for interacting with [FBP Protocol](http://flowbased.github.io/fbp-protocol/) runtimes. Underneath it utilizes the transport abstractions provided by [fbp-protocol-client](https://github.com/flowbased/fbp-protocol-client).\n\n## Features\n\n* Fully Promise-based API for interacting with the runtime\n* Responses to requests sent to runtime are handled via Promise resolving or rejection\n* Messages unrelated to current requests are provided via signal events\n* Protocol API is autogenerated from FBP Protocol JSON schemas, ensuring that it changes up to date with protocol features\n* All messages to and from runtime are validated against FBP Protocol specification\n\n## Installation\n\nInstall this library via NPM:\n\n```shell\n$ npm install fbp-client --save\n```\n\nPlease note that this library is shipped as ES6 code and utilizes native JavaScript Promises. If needed, you can install a Promise polyfill and transpile the code to ES5.\n\n## Usage\n\nCreate a client instance for a FBP Protocol runtime definition with:\n\n```javascript\nconst fbpClient = require('fbp-client');\n\nfbpClient({\n  address: 'wss://localhost:3569',\n  protocol: 'websocket',\n  secret: 'keyboard-cat',\n})\n  .then((client) =\u003e {\n    // Use this client instance for further interactions\n  });\n```\n\nConnect to runtime:\n\n```javascript\nclient.connect()\n  .then(() =\u003e {\n    // Connected to runtime\n  });\n```\n\nSend protocol messages:\n\n```javascript\nclient.protocol.runtime.packet({\n  graph: 'some-graph-id',\n  port: 'in',\n  event: 'data',\n  payload: 'Hello World!',\n})\n  .then(() =\u003e {\n    // Packet was sent\n  });\n```\n\n## Signals\n\nEvents coming from the runtime that are not direct responses to requests made by user are considered to be \"signals\". To subscribe to all signals coming from the client, use:\n\n```javascript\nclient.on('signal', signal =\u003e console.log(signal));\n```\n\nYou can also subscribe to signals for only one particular subprotocol with:\n\n```javascript\n// Only listen to network protocol\nclient.on('network', signal =\u003e console.log(signal));\n```\n\nMessages sent as responses to a request are not emitted as signals.\n\n### Observers\n\nIt is also possible to work with signals in a promisifed way by using observers:\n\n```javascript\n// Register observer for all network events\nconst observer client.observe(['network:*']);\n// Start the network\nclient.protocol.network.start({\n  graph: 'my-graph',\n})\n  .then(() =\u003e {\n    // Receive all network signals on stopped, or failure with errors\n    return observer.until(['network:stopped'], ['network:error', 'network:processerror']);\n  });\n```\n\n## Debugging\n\nIt is possible to see the internal workings of the library by setting the `DEBUG` environment variable to one or multiple of the following:\n\n* `fbp-client:adapter:signal`: Signals received by the runtime\n* `fbp-client:adapter:request`: Requests sent to the runtime\n* `fbp-client:adapter:response`: Responses received by the runtime\n* `fbp-client:observer`: Observer results\n* `fbp-client:observer:ignored`: Signals ignored by an observer\n\n## Changes\n\n* 0.4.3 (2020-10-02)\n  - Updated fbp-protocol-client to include improved connection error handling\n* 0.4.2 (2020-09-29)\n  - Updated fbp-protocol-client to include WebRTC support also on Node.js\n* 0.4.1 (2020-09-01)\n  - Updated fbp-protocol schemas to the latest versions\n* 0.4.0 (2019-02-26)\n  - `graph.properties.project` is no longer sent as the graph's \"library identifier\"\n* 0.3.3 (2018-04-06)\n  - Ensured that connection failures are sent as Error objects instead of WebSocket error events\n* 0.3.2 (2018-03-29)\n  - Schema validation can be disabled with `skipValidation: true` option. Validation failures still cause `protocolError` events to be emitted but not longer fail requests or observers\n  - When sending graphs, the graph `library` property will be preferred as the library name\n  - `disconnected` event will fire also if the connection is lost by other means that calling `disconnect()`\n* 0.3.1 (2018-03-26)\n  - Added `connected` and `disconnected` events\n* 0.3.0 (2018-03-26)\n  - Added support for checking capabilities.\n  - Disallowed messages cause requests to be rejected\n  - Disallowed signals trigger protocol error\n  - Permission checking can be disabled with `skipPermissions: true` option\n* 0.2.2 (2018-03-24)\n  - Fixed observer `until` failure handling on protocol validation errors\n  - Improved test coverage\n* 0.2.1 (2018-03-23)\n  - Observer `until` also fails on protocol validation errors\n  - Clearer observer error messages on error packets\n* 0.2.0 (2018-03-23)\n  - Added support for promisified signal observation\n  - Added debugging support via the [debug](https://www.npmjs.com/package/debug) module\n* 0.1.0 (2018-03-22)\n  - Initial version, support for FBP Protocol version 0.7 and earlier\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowbased%2Ffbp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowbased%2Ffbp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowbased%2Ffbp-client/lists"}