An open API service indexing awesome lists of open source software.

https://github.com/prolucid/fable-import-signalr

SignalR bindings for Fable
https://github.com/prolucid/fable-import-signalr

Last synced: 27 days ago
JSON representation

SignalR bindings for Fable

Awesome Lists containing this project

README

        

Fable bindings for [SignalR](http://www.asp.net/signalr)
=======

[![npm version](https://badge.fury.io/js/fable-import-signalr.svg)](https://badge.fury.io/js/fable-import-signalr)

## Usage

### Define hubs
```ocaml

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

type Hubs =
inherit SignalR
abstract myHub: HubClient
```
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
```

```