package bonsai

  1. Overview
  2. Docs
A library for building dynamic webapps, using Js_of_ocaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=c78c4476ee6b856846e2d0941e5965009d5e1b853e564b2b1bee61202f0b1ebb

doc/src/bonsai.example_chat_open_source_native_common/protocol.ml.html

Source file protocol.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
open! Core
open! Async_rpc_kernel

module Message_stream = struct
  let t =
    Rpc.Pipe_rpc.create
      ~name:"messages"
      ~version:0
      ~bin_query:[%bin_type_class: unit]
      ~bin_response:[%bin_type_class: Message.t]
      ~bin_error:[%bin_type_class: unit]
      ()
  ;;
end

module Messages_request = struct
  let t =
    Rpc.Rpc.create
      ~name:"get_messages"
      ~version:0
      ~bin_query:[%bin_type_class: Room.t]
      ~bin_response:[%bin_type_class: Message.t List.t]
      ~include_in_error_count:Only_on_exn
  ;;
end

module Send_message = struct
  let t =
    Rpc.Rpc.create
      ~name:"send_message"
      ~version:0
      ~bin_query:[%bin_type_class: Message.t]
      ~bin_response:[%bin_type_class: unit Or_error.t]
      ~include_in_error_count:Or_error
  ;;
end

module Create_room = struct
  let t =
    Rpc.Rpc.create
      ~name:"create_room"
      ~version:0
      ~bin_query:[%bin_type_class: Room.t]
      ~bin_response:[%bin_type_class: unit Or_error.t]
      ~include_in_error_count:Or_error
  ;;
end

module List_rooms = struct
  let t =
    Rpc.Rpc.create
      ~name:"list_rooms"
      ~version:0
      ~bin_query:[%bin_type_class: unit]
      ~bin_response:[%bin_type_class: Room.t List.t]
      ~include_in_error_count:Only_on_exn
  ;;
end