package eliom

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file eliom_comet_base.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# 1 "src/lib/eliom_comet_base.shared.ml"
(* Ocsigen
 * http://www.ocsigen.org
 * Copyright (C) 2010-2011
 * Raphaël Proust
 * Pierre Chambart
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, with linking exception;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *)

type 'a chan_id = string

external string_of_chan_id : 'a chan_id -> string = "%identity"
external chan_id_of_string : string -> 'a chan_id = "%identity"

[@@@warning "-39"]

type position =
  | Newest of int
  | After of int
  | Last of int option (* None means this is a 'newest channel' *)
[@@deriving json]

type comet_stateless_request = (string * position) array [@@deriving json]
type command = Register of string | Close of string [@@deriving json]

type comet_stateful_request = Request_data of int | Commands of command array
[@@deriving json]

type comet_request =
  | Stateless of comet_stateless_request
  | Stateful of comet_stateful_request
[@@deriving json]

type 'a channel_data = Data of 'a | Full | Closed [@@deriving json]

type answer =
  | Stateless_messages of (string * (string * int) channel_data) array
  | Stateful_messages of (string * string channel_data) array
  | Timeout
  | State_closed
  | Comet_error of string
[@@deriving json]

[@@@warning "+39"]

let comet_request_param =
  Eliom_parameter.ocaml "comet_request" [%json: comet_request]

type comet_service =
  | Comet_service :
      ( unit
        , bool * comet_request
        , Eliom_service.post
        , Eliom_service.att
        , _
        , _
        , _
        , [`WithoutSuffix]
        , unit
        , [`One of bool] Eliom_parameter.param_name
          * [`One of comet_request Eliom_parameter.ocaml]
              Eliom_parameter.param_name
        , Eliom_service.non_ocaml )
        Eliom_service.t
      * command list ref
      -> comet_service

type internal_comet_service =
  | Internal_comet_service :
      ( unit
        , bool * comet_request
        , Eliom_service.post
        , Eliom_service.att
        , _
        , Eliom_service.non_ext
        , Eliom_service.reg
        , [`WithoutSuffix]
        , unit
        , [`One of bool] Eliom_parameter.param_name
          * [`One of comet_request Eliom_parameter.ocaml]
              Eliom_parameter.param_name
        , Eliom_service.non_ocaml )
        Eliom_service.t
      * command list ref
      -> internal_comet_service

type stateless_kind =
  | After_kind of int
  | Newest_kind of int
  | Last_kind of int option

type 'a wrapped_channel =
  | Stateful_channel of (comet_service * 'a chan_id)
  | Stateless_channel of (comet_service * 'a chan_id * stateless_kind)

type 'a bus_send_service =
  | Bus_send_service :
      ( unit
        , 'a list
        , Eliom_service.post
        , Eliom_service.non_att
        , Eliom_service.co
        , Eliom_service.non_ext
        , Eliom_service.reg
        , [`WithoutSuffix]
        , unit
        , [`One of 'a list Eliom_parameter.ocaml] Eliom_parameter.param_name
        , Eliom_service.non_ocaml )
        Eliom_service.t
      -> 'a bus_send_service

type ('a, 'b) wrapped_bus = 'b wrapped_channel * 'a bus_send_service
OCaml

Innovation. Community. Security.