{"id":15984306,"url":"https://github.com/molda/pubsub","last_synced_at":"2025-10-24T16:52:16.386Z","repository":{"id":208443238,"uuid":"189079232","full_name":"molda/PubSub","owner":"molda","description":"Simple Publish/Subscribe module","archived":false,"fork":false,"pushed_at":"2022-10-12T08:37:54.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T10:48:11.208Z","etag":null,"topics":["module","pubsub","totaljs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/molda.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}},"created_at":"2019-05-28T18:08:57.000Z","updated_at":"2022-10-12T08:37:02.000Z","dependencies_parsed_at":"2023-11-21T14:50:01.645Z","dependency_job_id":"adea9964-6176-4be3-9a67-078f1e0ba16c","html_url":"https://github.com/molda/PubSub","commit_stats":null,"previous_names":["molda/pubsub"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molda%2FPubSub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molda%2FPubSub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molda%2FPubSub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molda%2FPubSub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/molda","download_url":"https://codeload.github.com/molda/PubSub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249600,"owners_count":20908211,"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":["module","pubsub","totaljs"],"created_at":"2024-10-08T02:06:35.634Z","updated_at":"2025-10-04T15:05:13.808Z","avatar_url":"https://github.com/molda.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PubSub\n\nSimple implementation of Publisher/Subscriber system as a module for Total.js framework\n\nClient library is served at /@pubsub/client.js\nIt reconnects automaticaly when a connection is lost.\n\n## Instalation\nJust place the pubsub.js file in \u003cyour-app-folder\u003e/modules/ folder.\n\n## Usage\n\nServer:\n```javascript\n\t// subscribe to a single topic\n\tPUBSUB.subscribe('hello');\n\n\t// subscribe to a multiple topics\n\tPUBSUB.subscribe([ 'hello2', 'hello3' ]);\n\n\t// unsubscribe from a single topic\n\tPUBSUB.unsubscribe('hello');\n\n\t// unsubscribe from a multiple topics\n\tPUBSUB.unsubscribe([ 'hello2', 'hello3' ]);\n\n\t// listen for a message with 'hello' topic\n\tPUBSUB.on('hello', function(msg){\n\t\tconsole.log('hello', msg);\n\t});\n\n\t// listen for all the message subscribed to\n\tPUBSUB.on('message', function(topic, msg){\n\t\tconsole.log('message', topic, msg);\n\t});\n\n\t// publish a message with 'hello' topic\n\tPUBSUB.publish('hello', 'world');\n```\n\n\n\nClient:\n```javascript\n\t\u003cscript src=\"/@pubsub/client.js\"\u003e\u003c/script\u003e\n\t\u003cscript\u003e\n\t\tvar pubsub = new PubSub();\n\n\t\t// event emited once the websocket successfuly connects to the server\n\t\tpubsub.on('connected', function(){\n\t\t\tconsole.log('connected');\n\n\t\t\t// subscribe to a single topic\n\t\t\tpubsub.subscribe('hello');\n\n\t\t\t// subscribe to a multiple topics\n\t\t\tpubsub.subscribe([ 'hello2', 'hello3' ]);\n\n\t\t\t// unsubscribe from a single topic\n\t\t\tpubsub.unsubscribe('hello');\n\n\t\t\t// unsubscribe from a multiple topics\n\t\t\tpubsub.unsubscribe([ 'hello2', 'hello3' ]);\n\t\t});\n\n\t\t// event emited when the websocket disconnects from the server\n\t\tpubsub.on('disconnected', function(){\n\t\t\tconsole.log('disconnected');\n\t\t});\n\n\t\t// listen for a message with 'hello' topic\n\t\tpubsub.on('hello', function(msg){\n\t\t\tconsole.log('hello', msg);\n\t\t});\n\n\t\t// listen for all the message subscribed to\n\t\tpubsub.on('message', function(topic, msg){\n\t\t\tconsole.log('message', topic, msg);\n\t\t});\n\t\u003c/script\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmolda%2Fpubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmolda%2Fpubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmolda%2Fpubsub/lists"}