diff --git a/help.js b/help.js new file mode 100644 index 0000000..024b4ce --- /dev/null +++ b/help.js @@ -0,0 +1,22 @@ + +module.exports = { + description: 'gossip ssb messages without replicating the entire feed, aka "Out of Order"', + commands: { + get: { + type: 'async', + description: 'get a message', + args: { + id: { + type: 'MessageId', + description: 'the identity of the message to get', + optional: false + }, + timeout: { + type: 'number', + description: 'number of milliseconds to wait for this message, default: 5000, or as set in `config.ooo.timeout`. If timeout is zero it will wait forever.', + optional: true + } + } + } + } +} diff --git a/index.js b/index.js index b68f659..ed78f00 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,8 @@ exports.name = 'ooo' exports.version = '1.0.0' exports.manifest = { stream: 'duplex', - get: 'async' + get: 'async', + help: 'sync' } exports.permissions = { anonymous: {allow: ['stream']} @@ -65,7 +66,7 @@ exports.init = function (sbot, config) { function get (opts, cb) { var id = isMsg(opts) ? opts : opts.id - var timeout = conf.timeout == null ? 5000 : conf.timeout + var timeout = opts.timeout != null ? opts.timeout : conf.timeout == null ? 5000 : conf.timeout var timer if(timeout > 0) timer = setTimeout(function () { @@ -134,7 +135,10 @@ exports.init = function (sbot, config) { //called by muxrpc, so remote id is set as this.id return gq.createStream(this.id) }, - get: get + get: get, + help: function () { + return require('./help') + } } }