{"id":16977397,"url":"https://github.com/mryslab/js-banyan","last_synced_at":"2026-04-30T16:31:07.307Z","repository":{"id":72328503,"uuid":"124942028","full_name":"MrYsLab/js-banyan","owner":"MrYsLab","description":"A Banyan Compatible Framework For JavaScript","archived":false,"fork":false,"pushed_at":"2020-07-07T21:56:18.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-29T18:40:39.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/MrYsLab.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-12T19:42:39.000Z","updated_at":"2020-07-07T21:56:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a3f7921-c386-49a1-bf59-ee1b6f2ed4a3","html_url":"https://github.com/MrYsLab/js-banyan","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":"0.19999999999999996","last_synced_commit":"3e6a9949417b35834224b1a13366d412edd0ff18"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MrYsLab/js-banyan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fjs-banyan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fjs-banyan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fjs-banyan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fjs-banyan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrYsLab","download_url":"https://codeload.github.com/MrYsLab/js-banyan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fjs-banyan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32470879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-14T01:28:52.125Z","updated_at":"2026-04-30T16:31:07.292Z","avatar_url":"https://github.com/MrYsLab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-banyan\n\n\n## This is a JavaScript compatible version of the [Python Banyan Framework](https://mryslab.github.io/python_banyan/).\n\n### Install with: npm js-banyan -g\n\nBanyan is a lightweight, reactive framework used to create flexible, non-blocking, \nevent driven, asynchronous applications. It was designed primarily to \nimplement physical computing applications for devices such as the \nRaspberry Pi and Arduino, but it is not limited to just the physical computing domain, \nand may be used to create applications in any domain.\n\nBanyan applications are comprised of a set of components, each component being a seperate process. \nComponents communicate with each other by publishing and subscribing to language independent protocol messages.\nAs a result, any component can communicate with any other component, regardless of computer language.\nEach Banyan component connects to a common Banyan backplane that distributes published messages to all message\nsubscribers. The backplane is provided as a command line executable as part of this package and is invoked with\n\n```$xslt\njsbackplane\n```\n\n__MAKE SURE YOU START THE BACKPLANE BEFORE STARTING ANY COMPONENT (INCLUDE THE MONITOR)__\n\nIn addition a monitor command line monitor utility is also provided to monitor all backplane traffic.\n\n```$xslt\njsmonitor\n```\n\nAll Banyan components are created by inheriting from a simple base class.\n\nThe base class for JavaScript is called banyan_base.js, and here is its api:\n\n```\nclass BanyanBase {\n\n    /**\n     * The constructor sets up all the ZeroMQ \"plumbing\"\n     * @param backplaneIpAddress: IP address of the machine running the\n     *                            backplane. If not specified, the address\n     *                            of the local machine will be used.\n     * @param subscriberPort: banyan_base back plane subscriber port.\n     This must match that of the banyan_base backplane.\n     * @param publisherPort: banyan_base back plane publisher port. T\n     *                        his must match that of the banyan_base backplane\n     * @param processName: Component identifier.\n     */\n    constructor({\n                    backplaneIpAddress = undefined, subscriberPort = '43125',\n                    publisherPort = '43124', processName = 'GIVE_ME_A_NAME'\n                } = {})\n                \n    /**\n         * This method subscribes to the specified topic.\n         * You can subscribe to multiple topics by calling this method for\n         each topic.\n         * @param topic: Topic string.\n         */\n        set_subscriber_topic(topic)\n        \n    /**\n         * This method will publish a banyan payload and its associated topic/\n         * @param payload: A dictionary as a set of Name/value pairs\n         * @param topic: Topic string associated with this payload\n         */\n    \n        publish_payload(payload, topic)\n        \n    /**\n         * This method receives incoming ZeroMQ messages for subscribed topics.\n         * It processes these messages by calling the incoming_message_processing\n         * method.\n         */\n        receive_loop()\n        \n    /**\n         * General cleanup before shutting down.\n         */\n        clean_up()    \n```\n\nExamples: An echo server and echo client\n\nThe Server\n\n```$xslt\nconst BanyanBase = require('js-banyan/lib/banyan_base');\n\nclass SimpleEchoServer extends BanyanBase {\n\n    constructor() {\n\n        super({ processName: 'SimpleEchoServer'\n        });\n\n        this.set_subscriber_topic('echo');\n        this.receive_loop();\n    }\n\n    incoming_message_processing( topic, payload) {\n        this.publish_payload(payload, 'reply');\n    }\n}\ntry {\n    new SimpleEchoServer();\n}\ncatch(err){\n    process.exit()\n}\n```\n\nThe Client\n```$xslt\nconst BanyanBase = require('js-banyan/lib/banyan_base');\n\nclass SimpleEchoClient extends BanyanBase {\n\n    constructor({number_of_messages = 1000} = {}) {\n\n        super({\n            processName: 'SimpleEchoClient'\n        });\n\n        this.set_subscriber_topic('reply');\n\n        //sequence number of messages\n        this.message_number = number_of_messages;\n        this.number_of_messages = number_of_messages;\n\n        //send the first message - make sure that the server is already started\n        this.publish_payload({'message_number': this.message_number}, 'echo');\n        this.message_number -= 1;\n\n        //get the reply messages\n        this.receive_loop();\n    } // end of constructor\n\n    incoming_message_processing(topic, payload) {\n\n        if (payload['message_number'] === 0) {\n\n            console.log(this.number_of_messages + ' messages sent and received');\n            process.exit(0);\n        }\n        else {\n            this.message_number -= 1;\n            if (this.message_number \u003e= 0) {\n                this.publish_payload({'message_number': this.message_number}, 'echo');\n            }\n        }\n    }\n}\n\ntry {\n    m = new SimpleEchoClient();\n}\ncatch (err) {\n    process.exit()\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmryslab%2Fjs-banyan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmryslab%2Fjs-banyan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmryslab%2Fjs-banyan/lists"}