hostmeta
Version:
Easily retrieve and parse a host's .well-known/host-meta file
61 lines (44 loc) • 1.72 kB
Markdown
[](https://npmjs.org/package/hostmeta)
[](https://npmjs.org/package/hostmeta)
[](https://travis-ci.org/otalk/hostmeta.js)
[](https://david-dm.org/otalk/hostmeta.js)
[](https://ci.testling.com/otalk/hostmeta.js)
A browser module for looking up metadata about a host, using the `/.well-known/host-meta[.json]` files, which is useful for discovering associated services for a host, such as an OpenID endpoint or where to connect for an XMPP BOSH/WebSocket session.
```
$ npm install hostmeta
```
```sh
$ make build
```
The bundled and minified files will be in the generated `build` directory.
```js
var getHostMeta = require('hostmeta');
getHostMeta('example.com', function (err, data) {
if (err) {
console.log("Couldn't retrieve host-meta data");
}
console.log(data);
// Where data might look like:
// {
// "links": [
// {
// "rel": "urn:xmpp:alt-connections:websocket",
// "href': "wss://example.com:5281/xmpp-websocket"
// },
// {
// "rel": "author",
// "href': "http://example.com/joe"
// }
// ]
// }
});
```
MIT
If you like this, follow: [@lancestout](http://twitter.com/lancestout) on twitter.