0.4.0 • Published 8 years ago

fable-import-signalr v0.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Fable bindings for SignalR

npm version

Usage

Define hubs

    type [<AllowNullLiteral>] MyHub =
        abstract myUpdate: (float -> unit) with get, set

    type Hubs =
        inherit SignalR
        abstract myHub: HubClient<MyHub>

Notes:

  • Hubs inherits from SignalR
  • HubClient is a binding that wraps members on the given type in a client variable

Subscribe to hubs and start connection

let connection = Globals.jQuery.connection :> Hubs
connection.myHub.client.myUpdate <- (fun value -> printf "Got updated value: %f" value)
connection.hub.start[ Transport [| "serverSentEvents"; "longPolling" |]] |> ignore

Add Dependencies

<script src="https://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.2.1.min.js"></script>
<script src="/signalr/hubs"></script>
0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago