Fix content-length mismatches
[hiphop-php.git] / hphp / hack / src / utils / jsonrpc / jsonrpc.mli
blobab6240d4f71d047493b1b59ad129dc4b2be5f61f
1 (*
2 * Copyright (c) 2017, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 type writer = Hh_json.json -> unit
12 type timestamped_json = {
13 json: Hh_json.json;
14 timestamp: float;
17 type t
19 (** must call Daemon.entry_point at start of your main *)
20 val make_t : unit -> t
22 (** says whether there's already an item on the queue, or stdin is readable meaning that there's something pending on it *)
23 val has_message : t -> bool
25 (** similar to [has_message], but can be used to power a 'select' syscall
26 which will fire when a message is available. *)
27 val await_until_message :
28 t -> [> `Already_has_message | `Wait_for_data_here of Unix.file_descr ]
30 (** says whether the things we've already enqueued from stdin contain a message that matches the predicate *)
31 val find_already_queued_message :
32 f:(timestamped_json -> bool) -> t -> timestamped_json option
34 val get_message :
35 t ->
36 [> `Message of timestamped_json
37 | `Fatal_exception of Marshal_tools.remote_exception_data
38 | `Recoverable_exception of Marshal_tools.remote_exception_data
40 Lwt.t
42 val get_next_request_id : unit -> int