{"id":16241160,"url":"https://github.com/strophe/strophejs-plugin-disco","last_synced_at":"2025-03-19T16:31:46.264Z","repository":{"id":57372908,"uuid":"80017910","full_name":"strophe/strophejs-plugin-disco","owner":"strophe","description":null,"archived":false,"fork":false,"pushed_at":"2017-08-09T09:31:47.000Z","size":54,"stargazers_count":1,"open_issues_count":1,"forks_count":7,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-02-28T19:55:51.920Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strophe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-25T13:41:03.000Z","updated_at":"2018-07-22T19:26:26.000Z","dependencies_parsed_at":"2022-08-29T11:01:58.746Z","dependency_job_id":null,"html_url":"https://github.com/strophe/strophejs-plugin-disco","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-disco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-disco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-disco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-disco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strophe","download_url":"https://codeload.github.com/strophe/strophejs-plugin-disco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244006277,"owners_count":20382444,"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-10T14:06:28.021Z","updated_at":"2025-03-19T16:31:45.997Z","avatar_url":"https://github.com/strophe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# strophe.disco.js\n\nPlugin for [strophe.js](https://www.npmjs.com/package/strophe.js) to provide Service Discovery\n([XEP-0030](http://xmpp.org/extensions/xep-0030.html)).\n\n## Install\n\n    npm install strophejs-plugin-disco\n\nThere are two plugins available.\n\n## Plugin A (default)\n\nThis [plugin](https://github.com/strophe/strophejs-plugin-disco/blob/master/src/strophe.disco.js) allows to\nsend disco queries and registers handlers that respond to incoming queries.\n\n### Usage\n\n    var c = new Strophe.Connection('bosh-service');\n    c.connect(jid,pw);\n    c.disco.info(jid,callback);\n\n#### Run Specs\n\nuse node with jasmine-node plugin to run the specs\n\n### ToDo\n\n- cleanup stanza specs using Strophe.Builder instead of strings\n\n## Plugin B\n\nThe [plugin](https://github.com/strophe/strophejs-plugin-disco/blob/master/public/javascript/strophe.disco.js)\nfacilitates client and server side handling of discovery messages.\n\n### Client Side\n\nThe plugin provides to methods (info and items) on top of the disco object that\nis added to the connection. You use them as follows\n\n    var c = new Strophe.Connection('http://localhost/xmpp-httpbind');\n    c.connect('andi@psi/strophe','andi');\n    c.disco.info('andi@psi/psi');\n\nYou can also pass a node, success and error handlers to the method.\nThe items method behaves in the same way. Just make sure that your success and\nerror handlers are passed after the node (if any).\n\n### Server Side\n\nThe module adds response handlers to info and item queries.\nThe disco object added to the connection has members for features and identity\nthat will be used to populate the disco#info response.\n\n     \u003ciq xmlns='jabber:client' from='andi@psi/strophe' to='andi@psi/strophe2' type='result' id='4774:sendIQ'\u003e\u003cquery xmlns='http://jabber.org/protocol/disco#info'\u003e\u003cidentity name='strophe'/\u003e\u003cfeature var='http://jabber.org/protocol/disco#info'/\u003e\u003cfeature var='http://jabber.org/protocol/disco#items'/\u003e\u003c/query\u003e\u003c/iq\u003e\n\nYou can additional nodes using addNode, e.g.\n    c.disco.addNode('aNode', { items: [{node: 'aNode', name: 'aName'}]  });\n\nand then query for them using the items method\n\n    c1.disco.items('andi@psi/strophe', 'aNode', function(s) { console.log(Strophe.serialize(s)) ; } )\n\nSee the specs for details.\n\n## Tests\n\nTo run the specs you should install jasmine-tool for nodejs via npm and update\nthe references to the external libraries (Strophe, jQuery) in jasmine.json.\nAfter that you run\n\n    $\u003e jasmine mon\n\nand navigate your browser to http://localhost:8124 to view the specs executing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrophe%2Fstrophejs-plugin-disco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrophe%2Fstrophejs-plugin-disco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrophe%2Fstrophejs-plugin-disco/lists"}