Skip to content

Instantly share code, notes, and snippets.

@FunctionalFirst
Created November 17, 2014 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FunctionalFirst/0348951e82335a5add3d to your computer and use it in GitHub Desktop.
Save FunctionalFirst/0348951e82335a5add3d to your computer and use it in GitHub Desktop.
let rec AsyncAcceptMessages(client : WebSocket) =
async {
let! message = client.AsyncReadMessage
if(not(isNull message)) then
let s =
use reader = new StreamReader(message)
reader.ReadToEnd()
do
use writer = new StreamWriter(client.CreateMessageWriter(WebSocketMessageType.Text), Encoding.UTF8)
writer.Write s
printf "%s" <| s
do! AsyncAcceptMessages client
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment