{"id":17141784,"url":"https://github.com/zmofei/mpubsub","last_synced_at":"2025-04-13T10:35:58.981Z","repository":{"id":16665541,"uuid":"19421188","full_name":"zmofei/mPubsub","owner":"zmofei","description":"Built pubsub servers and clients using pure node.js ","archived":false,"fork":false,"pushed_at":"2015-01-15T09:58:32.000Z","size":176,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-11T02:54:12.742Z","etag":null,"topics":[],"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/zmofei.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":"2014-05-04T07:23:03.000Z","updated_at":"2015-09-14T08:13:19.000Z","dependencies_parsed_at":"2022-09-14T22:20:26.554Z","dependency_job_id":null,"html_url":"https://github.com/zmofei/mPubsub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmofei%2FmPubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmofei%2FmPubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmofei%2FmPubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmofei%2FmPubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zmofei","download_url":"https://codeload.github.com/zmofei/mPubsub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248700090,"owners_count":21147764,"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":[],"created_at":"2024-10-14T20:27:05.720Z","updated_at":"2025-04-13T10:35:58.954Z","avatar_url":"https://github.com/zmofei.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"mPubsub\n=======\n\nBuilt pubsub servers and clients using pure node.js \n\n## Install\n```bash\n$ npm install mpubsub\n```\n##Usage\n\n### Setup\n\n```javascript\nvar mPubsub=require('mpubsub');   \n```\n\n### Server side\nFirst you should start the pub-sub server\n```javascript\nmPubsub.createServer('127.0.0.1',4455);   //create a server at ip:127.0.0.1 and port:4455\n```\n\n### Client side\nOnce you start the server , you can connect to the serve and share the pub-sub\n\n```javascript\n//connect to the server (IP:127.0.0.1,port:4455);\nmPubsub.connect('127.0.0.1', 4455, function(socket) {\n\n\t//SUB\n\t//sub a channel\n\t//scoket.sub(channel,callback)\n    socket.sub('abc1', function(data) {\n    \t//when somebody publish something in channel 'abc',the following will work\n        console.log('sub data', data);\n    });\n\n    //UNSUB\n    //unsub a channel\n    //socket.unsub('channel');\n    socket.unsub('abc2');\n\n    //PUBLISH\n    //pub something to channel abc\n\t//scoket.pub(channel,data)\n    socket.pub('abc', '123asd');\n\n    //END\n    socket.end();\n\n});\n``` \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmofei%2Fmpubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmofei%2Fmpubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmofei%2Fmpubsub/lists"}