F# web socket with Saturn

I am struggling to get a minimal web-socket app working using SAFE. I have had this working on the SAFE stack of about 2 years ago but can’t get the join function (shown below) to work using the latest packages and Net8.0

    let channel = channel {
        join (fun ctx socketId ->
            task {
                ctx.GetLogger().LogInformation("Client has connected. They've been assigned socket Id: {socketId}", socketId)
                return Channels.Ok
            })

..I get the console message that the function has been called but also an error saying that the method RecyclableMemoryStreamManager.GetStream() cannot be found.

 Client has connected. They've been assigned socket Id: { SocketId = 257a9ac9-3325-4269-8a58-a6e2e529fc96 }
server: fail: Giraffe.Middleware.GiraffeErrorHandlerMiddleware[0]
server:       An unhandled exception has occurred while executing the request.
server:       System.MissingMethodException: Method not found: 'System.IO.MemoryStream Microsoft.IO.RecyclableMemoryStreamManager.GetStream()'.  
server:          at FSharp.Control.Websockets.ThreadSafeWebSocket.receiveMessageAsUTF8@664-6.Invoke(Unit unitVar)
server:          at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 510
server:          at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 112    
server:       --- End of stack trace from previous location ---
server:          at [email protected]()
server:          at [email protected]()

I had a look at FSharp.Core\async.fs, but am none-the-wiser for it.

Leave a Comment