Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

muxrpcli@3 help #6

Merged
merged 1 commit into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions help.js
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
}
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']}
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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')
}
}
}