Discovering a list of commands supported by the server use:
socket.send( 'xmpp.command.list' { /* "to": "evilprofessor.co.uk" */ }, function(error, data) { console.log(error, data) } )
Not providing a `to` key results in the request being made against the user's XMPP domain.
Example response:
[ { node: 'config', name: 'Configure Service' }, { node: 'reset', name: 'Reset Configuration' } ]
socket.send( 'xmpp.command.info', { "node": "config", /* "to": "evilprofessor.co.uk" */ }, function(error, data) { console.log(error, data) } )
Example response:
[ { kind: 'identity', type: 'command-node', name: 'Configure Service', category: 'automation' }, { kind: 'feature', var: 'http://jabber.org/protocol/commands' }, { kind: 'feature', var: 'jabber:x:data' } ]
Executing a command is handled using the xmpp.command.do event.
socket.send( 'xmpp.command.do' { /* "to": "evilprofessor.co.uk", */ "node": "config", /* "action": "execute", */ /* "form": [] */ /* "sessionId": "some-session-id" */ }, function(error, data) { console.log(error, data) } )
Where `form` is formatted as a standard data form.
Example response:
{ status: "completed", /* note: { type: 'info', description: 'Server has been restarted' }, */ /* actions: { execute: 'next', values: [ 'prev', 'next'] }, */ /* sessionId: "some-session-id" */ /* form: ...parsed as dataform */ /* oob: ...parsed as OOB data */ }