Skip to content

F# Examples

F# examples use the same NuGet packages as the C# examples.

Service SDKs

Same packages as C# — all Virtufin .NET client libraries are compatible with F#.

Key Patterns

open Virtufin.WebSocketManager.Client

use client = new WebSocketManagerClient(host)
let! result = client.ConnectAsync(ConnectRequest(
    Url = "wss://stream.binance.com:9443/ws/btcusdt@depth@100ms",
    AutoReconnect = true,
    CorrelationMode = CorrelationMode.Raw
)) |> Async.AwaitTask
printfn $"Connected: id={result.Id}"

Differences from C#:

  • Uses Async.AwaitTask to bridge .NET Tasks to F# async workflows
  • Uses Option.ofObj for nullable environment variable handling
  • Pattern matching with match ... with instead of switch