{"id":21841956,"url":"https://github.com/adhdtech/drp","last_synced_at":"2025-04-14T11:52:02.101Z","repository":{"id":38047685,"uuid":"164383684","full_name":"adhdtech/DRP","owner":"adhdtech","description":"DRP - A websocket subprotocol for declaring and consuming resources","archived":false,"fork":false,"pushed_at":"2024-08-24T23:55:07.000Z","size":13190,"stargazers_count":13,"open_issues_count":22,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-16T05:31:33.529Z","etag":null,"topics":["broker","datamesh","drp","mesh","nodejs","provider","registry","service","streams","websocket-subprotocol","websockets"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adhdtech.png","metadata":{"files":{"readme":"README-MermaidCode.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-07T05:43:05.000Z","updated_at":"2024-08-24T23:55:04.000Z","dependencies_parsed_at":"2024-01-13T22:49:52.417Z","dependency_job_id":"a69ea33a-0e83-469f-9e89-c444d7033bca","html_url":"https://github.com/adhdtech/DRP","commit_stats":{"total_commits":778,"total_committers":4,"mean_commits":194.5,"dds":0.3856041131105399,"last_synced_commit":"cc4003946dad16d0b2134f1826461180ca41a88d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhdtech%2FDRP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhdtech%2FDRP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhdtech%2FDRP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhdtech%2FDRP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adhdtech","download_url":"https://codeload.github.com/adhdtech/DRP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877986,"owners_count":21176239,"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":["broker","datamesh","drp","mesh","nodejs","provider","registry","service","streams","websocket-subprotocol","websockets"],"created_at":"2024-11-27T22:09:18.883Z","updated_at":"2025-04-14T11:52:02.048Z","avatar_url":"https://github.com/adhdtech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## DRP\nDeclarative Resource Protocol - a JSON based Websocket subprotocol for declaring and consuming resources.\n\n## Overview\nIn legacy applications, resource dependencies are often statically defined.  When a new service component is\nintroduced, DNS, load balancer entries, firewall rules, monitoring, etc must be provisioned.  DRP can reduce\ncomplexity by providing a mechanism for allowing service providers to self-register and dynamically routing\nresource requests.\n\n## Goals\n* Reduce barriers between resources and consumers\n* Minimize infrastructure component requirements\n* Reduce complexity involved in implementing HA\n* Provide mechanism for resource discovery and structure traversal\n\n## Components\n**Registries** - Track and distribute state of providers and their resources\u003cbr\u003e\n**Providers** - Declare services, objects and streams available for consumption\u003cbr\u003e\n**Brokers** - Process resource requests and track declarations from consumers\u003cbr\u003e\n**Consumers** - Client facing applications, monitoring and analytics\u003cbr\u003e\n\n## Demo\nCheckout repo, change to directory.  Execute the following to start a demo service which provides the Registry, Provider and Broker routes on ws://localhost:8080\n```\nnpm install\nnode server.js\n```\n\n## Sample Provider\nThis sample will start a Provider which listens on ws://localhost:8081/provider and connects to the Registry on ws://localhost:8080/registry\n```\nnode testProvider.js\n```\n## Sample Provider - No Listener\nThis sample will start a Provider which does not listen for connections; it connects directly to Brokers who need it\n```\nnode testProvider-NoListener.js\n```\n\n## Sample Client\nThis sample will start a Consumer which connects to the Broker on ws://localhost:8080/broker and subscribes to the dummy stream\n```\nnode testClient.js\n```\n\n## Web UI\nRunning server.js will also start the rSage web interface on http://localhost:8080 which connects to the Broker on ws://localhost:8080/broker.  Click Go -\u003e Command Testing to see the commands exposed to DRP Consumers.\u003cbr\u003e\n* **getCmds** - List DRP Consumer commands\u003cbr\u003e\n* **getRegistry** - Get dump of Registry\u003cbr\u003e\n* **listServiceInstances** - List Services and which Providers offer them\u003cbr\u003e\n* ... more ....\n\n## PowerShell PSDrive\nNavigate the DRP topology via CLI using the DRPDrive.dll module.  Open a PowerShell session and run the following.\n```\ncd PSDrive\\bin\\Debug\nImport-Module .\\DRPDrive.dll\nConnect-DRP -Alias dev -URL ws://localhost:8080/broker\ndir drp:\\dev\ndir drp:\\dev\\Registry\ndir drp:\\dev\\Providers\n\n# View last 10 messages in a topic\ndir drp:\\dev\\Providers\\{providerID}\\Streams\\dummy\\History\n\n# Execute a service command\ngi drp:\\dev\\Services\\Greeter\\ClientCmds\\sayHi\n\n# View list of Consumers\ndir drp:\\dev\\Consumers\n\n# Retrieve HTML document from a consumer web session for debugging\ngi drp:\\dev\\Consumers\\{id}\\HTMLDocument\\children\\0\\outerHTML\n\n# Execute a command on the consumer web session to RickRoll the user\ngi drp:\\dev\\Consumers\\{id}\\RickRoll\n```\n\n\n## Stream Subscription\n```mermaid\nsequenceDiagram\n    participant Provider\n    participant Registry\n    participant Broker\n    Note left of Provider: Startup\n    Provider--\u003e\u003eRegistry: ws://\u003cregsvc\u003e/registry\n    Broker--\u003e\u003eRegistry: ws://\u003cregsvc\u003e/registry\n    Broker-\u003e\u003eRegistry: {cmd:\"getDeclarations\",token:1}\n    Note right of Registry: *Gather Declarations \u003cpayload\u003e\n    Registry-\u003e\u003eBroker: {token:1, payload: {streams:[\"hostReport\"]}}}\n    Note left of Consumer: Startup\n    Consumer--\u003e\u003eBroker: ws://\u003cregsvc\u003e/broker\n    Consumer-\u003e\u003eBroker: {\"type\":\"cmd\",\"method\":\"subscribe\",\"params\":{\"topicName\":\"hostReport\",\"streamToken\":123}}\n    Note right of Broker: *Register subscription\u003cbr\u003e*Determine list of providers\n    Broker--\u003e\u003eProvider: ws://\u003cprovidersvc\u003e/provider\n    Broker-\u003e\u003eProvider: {\"type\":\"cmd\",\"method\":\"subscribe\",\"params\":{\"topicName\":\"hostReport\",\"streamToken\":123}}\n    Note right of Provider: Stream Data \u003cpayload\u003e\n    Provider-\u003e\u003eBroker: {\"type\":\"stream\", token:123, status, payload: \u003cpayload\u003e}\n    Note right of Broker: Relay to\u003cbr\u003eConsumers\n    Broker-\u003e\u003eConsumer: {\"type\":\"stream\", token:123, status, payload: \u003cpayload\u003e}\n```\n\n## Stream Subscription (Provider behind firewall or not listening)\n```mermaid\nsequenceDiagram\n    participant Provider\n    participant Registry\n    participant Broker\n    Note left of Provider: Startup\n    Provider--\u003e\u003eRegistry: ws://\u003cregsvc\u003e/registry\n    Broker--\u003e\u003eRegistry: ws://\u003cregsvc\u003e/registry\n    Broker-\u003e\u003eRegistry: {cmd:\"getDeclarations\",token:1}\n    Note right of Registry: *Gather Declarations \u003cpayload\u003e\n    Registry-\u003e\u003eBroker: {token:1, payload: {streams:[\"hostReport\"]}}}\n    Note left of Consumer: Startup\n    Consumer--\u003e\u003eBroker: ws://\u003cregsvc\u003e/broker\n    Consumer-\u003e\u003eBroker: {\"type\":\"cmd\",\"method\":\"subscribe\",\"params\":{\"topicName\":\"hostReport\",\"streamToken\":123}}\n    Note right of Broker: *Register subscription\u003cbr\u003e*Determine list of providers\n    Broker-\u003e\u003eRegistry: {\"type\":\"cmd\",\"method\":\"brokerToProvider\",\"params\":{\"brokerID\":\u003cbrokerID\u003e,\"brokerURL\":\"ws://\u003cbrokersvc\u003e/broker\"}}\n    Registry-\u003e\u003eProvider: {\"type\":\"cmd\",\"method\":\"brokerToProvider\",\"params\":{\"brokerID\":\u003cbrokerID\u003e,\"brokerURL\":\"ws://\u003cbrokersvc\u003e/broker\"}}\n    Provider--\u003e\u003eBroker: ws://\u003cbrokersvc\u003e/broker\n    Broker-\u003e\u003eProvider: {\"type\":\"cmd\",\"method\":\"subscribe\",\"params\":{\"topicName\":\"hostReport\",\"streamToken\":123}}\n    Note right of Provider: Stream Data \u003cpayload\u003e\n    Provider-\u003e\u003eBroker: {\"type\":\"stream\", token:123, status, payload: \u003cpayload\u003e}\n    Note right of Broker: Relay to\u003cbr\u003eConsumers\n    Broker-\u003e\u003eConsumer: {\"type\":\"stream\", token:123, status, payload: \u003cpayload\u003e}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhdtech%2Fdrp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadhdtech%2Fdrp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhdtech%2Fdrp/lists"}