项目作者: ethanhann

项目描述 :
AngularJS wrapper module for the official jQuery SignalR library.
高级语言: JavaScript
项目地址: git://github.com/ethanhann/eeh-signalr.git
创建时间: 2015-03-30T02:09:06Z
项目社区:https://github.com/ethanhann/eeh-signalr

开源协议:MIT License

下载


eeh-signalr

AngularJS wrapper module for the official jQuery SignalR client.

Usage

(Optional) Configure the SignalR URL

The URL is ‘/signalr’ by default.
If it is set to another value on the server, or if CORS is in use, it can be set when you configure your app.

  1. angular.module('myApp').config(function (eehSignalRProvider) {
  2. eehSignalRProvider.url('http://example.com/myCustomSignalRUrl');
  3. });

Inject the eehSignalR Service in a Controller (or somewhere else)

  1. angular.module('myApp')
  2. .controller('MainCtrl', function ($scope, eehSignalR) {
  3. var hub = eehSignalR.getHub('assetHub');
  4. hub.client.hello = function (message) {
  5. $scope.message = message;
  6. $scope.$apply();
  7. };
  8. eehSignalR.start();
  9. });