Fix catch trace bug and inline cost bug
[hiphop-php.git] / hphp / doc / server.xbox_server
blob7a73570cdfc02d116d4d251683d7846566e4c3c1
2 <h2> Xbox Server</h2>
4 Xbox stands for "cross-box" communication, and it's a very simple messaging
5 system. There are only 2 functions to learn,
7   $ret = null;
8   $code = xbox_send_message($msg, $ret, $timeout_ms, $host);
9   $code = xbox_post_message($msg, $host);
11 1. xbox_send_message()
13 xbox_send_message() is a blocking call. It will send the message, which is just
14 a string, to specified host. It waits for $timeout_ms long and returns 0 if
15 times out. On the specified host's side, there has to be an xbox server that's
16 set up through compiled program's options, and one also has to implement a PHP
17 function like this,
19   function xbox_process_message($msg) {
20     ...
21     return $ret;
22   }
24 The final result gets returned to the caller if timeout hasn't been reached and
25 the $code would be 200. The function name is configurable, but it is by design
26 to have just one function to serve as main entry point of all messages. A
27 message string can encode message types by itself.
29 2. xbox_post_message()
31 xbox_post_message() is a non-blocking call. It will not wait for server to
32 process the message and it will return 200 immediately, unless server cannot
33 be contacted at all.
35 3. local host
37 When $host is local, xbox task functions give more control over task statuses.
38 In that case, xbox processing becomes a multi-threading facility that's better
39 described in "threading" documentation.