我有形式簡單Suave.io服務器最簡單的方法: let Ok o = o |> JsonConvert.SerializeObject |> Successful.OK
let NotOk o = o |> JsonConvert.SerializeObject |> RequestErrors.BAD_REQUEST
type Result<'T> =
| Success of 'T
我可以寫這樣的事情 let echo (ws: WebSocket) =
fun ctx -> socket {
let loop = ref true
while !loop do
let! message = Async.Choose (ws.read()) (inbox.Receive())
match message wi
我想動態生成服務器端的圖像並將其發送到瀏覽器。 當前我使用的是MemoryStream將其轉換爲byte array,然後通常suave api。參見下文: let draw (text:string) =
let redBr = new SolidBrush(Color.Red)
let whiteBr = new SolidBrush(Color.White)