package dream-httpaf
Internal: shared http/af stack for Dream (server) and Hyper (client)
Install
Dune Dependency
Authors
Maintainers
Sources
dream-1.0.0-alpha3.tar.gz
sha256=f289253109aee39ab912f9f38aa5e7b44e0b4b01fd7d3dd5c407b034c57f01bc
md5=148588e6f584cd9f2438e56da7df2f56
doc/src/dream-httpaf.websocketaf-lwt/websocketaf_lwt.ml.html
Source file websocketaf_lwt.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
let sha1 s = s |> Digestif.SHA1.digest_string |> Digestif.SHA1.to_raw_string include Websocketaf_lwt_intf module Server (Server_runtime: Gluten_lwt.Server) = struct type socket = Server_runtime.socket (* TODO: should this error handler be a websocket error handler or an HTTP * error handler?*) let create_connection_handler ?(config = Httpaf.Config.default) ~websocket_handler ~error_handler = fun client_addr socket -> let connection = Websocketaf.Server_connection.create ~sha1 ~error_handler:(error_handler client_addr) (websocket_handler client_addr) in Server_runtime.create_connection_handler ~read_buffer_size:config.read_buffer_size ~protocol:(module Websocketaf.Server_connection) connection client_addr socket end module Client (Client_runtime: Gluten_lwt.Client) = struct type t = Client_runtime.t type socket = Client_runtime.socket let connect ?(config=Httpaf.Config.default) ~nonce ~host ~port ~resource ~error_handler ~websocket_handler socket = let headers = Httpaf.Headers.of_list ["host", String.concat ":" [host; string_of_int port]] in let connection = Websocketaf.Client_connection.connect ~nonce ~headers ~sha1 ~error_handler ~websocket_handler resource in Client_runtime.create ~read_buffer_size:config.read_buffer_size ~protocol:(module Websocketaf.Client_connection) connection socket let is_closed t = Client_runtime.is_closed t end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>