v0.27.0 - Websocket support
In this release we include preliminary Websocket support; feedback is most welcome.
let echo (webSocket : WebSocket) =
fun cx -> async{
let loop = ref true
while !loop do
let! msg = webSocket.read()
match msg with
| (Text, data, true) ->
let str = UTF8.toString data
do! webSocket.send Text data true
| (Ping, _, _) ->
do! webSocket.send Pong [||] true
| (Close, _, _) ->
loop := false
| _ -> ()
return! Control.CLOSE cx
}
let app : WebPart =
choose [
path "/websocket" >>= handShake echo
GET >>= choose [ path "/" >>= file "index.html"; browseHome ];
NOT_FOUND "Found no handlers."
]
We also fixed a bug in the Razor module d295582