request.send

(since )



Send a command to the APE server

Description


string request.send ( mixed cmd, [string params], [object options] )

Send a command to the APE server

All the request function are also available on a pipe object. When you use it on a pipe, the pipe pubid is added to the parameters sent to APE the server

Parameters


cmd
If the argument is a string :
  • Command to send to APE server (eg : 'CONNECT') - ()
If the argument is an array :
  • An array with object containing cmd, params and sessid - ()

params
And object with params of the cmd

options
An object with request options :
  • sessid - (boolean, optional) ; defaults to : true Add sessid to the request.

Examples


//ape var is a reference to APE instance
 
//Send a connect command to server
ape.request.send('JOIN', {"channels":"testChannel"});
 
//Note : you can join a channel with the method join
ape.join('testChannel');
 
//Note : testCommand is not a real APE command, it's just used here as an example
ape.request.send('testCommand', {"param1":"value","param2":"value"});
 

Sending multiple command in one time
//ape var is a reference to APE instance
 
 
//This example sends a "JOIN" command,
// and "anotherCommand" with 2 arguments without adding sessid
ape.request.send([
    {
        "cmd":"JOIN", 
        "params": {
            "channels": "test1"
        }
    },
    {
        "cmd": "anotherCommand",
        "params": {
            "param1": "value",
            "param2": "value"
         },
        "sessid": false
    }
]);

User notes


# No comment

Post a note


User notes may be edited or deleted, and usually a note is deleted because of the following reasons:
  • Bugs: Instead report a bug
  • Missing documentation: report that as a bug.
  • Support questions: See the community for available options.

In other words, do not ask questions within the user notes.

Note <b>,<u>,<i> HTML tags are allowed in the posts and the note formatting is preserved. URLs will be turned into clickable links, JavaScipt and C code blocks enclosed in the <source="javascript">JS Code</source> and <source="c">C Code</source> tags will be source highlighted automatically.