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
- Host: GitHub
- URL: https://github.com/prolucid/fable-import-signalr
- Owner: Prolucid
- License: other
- Created: 2016-09-27T13:50:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-16T20:07:19.000Z (almost 7 years ago)
- Last Synced: 2025-03-12T23:45:26.246Z (about 2 months ago)
- Language: F#
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Fable bindings for [SignalR](http://www.asp.net/signalr)
=======[](https://badge.fury.io/js/fable-import-signalr)
## Usage
### Define hubs
```ocamltype [] MyHub =
abstract myUpdate: (float -> unit) with get, settype 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
``````