This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.vertx.core.Vertx | |
import io.vertx.ext.web.Route | |
import io.vertx.ext.web.Router | |
import io.vertx.ext.web.RoutingContext | |
import io.vertx.kotlin.coroutines.CoroutineVerticle | |
import io.vertx.kotlin.coroutines.await | |
import kotlin.coroutines.CoroutineContext | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.delay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Trie = struct | |
type t = { mutable count : int; children : t option Array.t } | |
let[@inline] empty () = { count = 0; children = Array.make 128 None } | |
let add buf pos len t = | |
let rec loop idx t = | |
if idx > pos + len - 1 then t.count <- t.count + 1 | |
else | |
let c = Char.lowercase_ascii (Bytes.get buf idx) in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Opium.Std | |
open Lwt.Infix | |
open Websocket | |
let src = Logs.Src.create "websocket.upgrade_connection" | |
(* Example from https://github.com/vbmithr/ocaml-websocket/blob/2e7fb23a7c2b7f52f0274db2687e1855c1ac5ae8/test/upgrade_connection.ml *) | |
let websocket_handler (_, conn) req body = | |
let open Frame in | |
Logs_lwt.app ~src (fun m -> |