https://github.com/danielkov/angular-wsocket.io-service
Angular service for wsocket.io for seemless integration.
https://github.com/danielkov/angular-wsocket.io-service
Last synced: about 1 year ago
JSON representation
Angular service for wsocket.io for seemless integration.
- Host: GitHub
- URL: https://github.com/danielkov/angular-wsocket.io-service
- Owner: danielkov
- Created: 2016-11-20T17:21:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-06T22:04:22.000Z (over 9 years ago)
- Last Synced: 2025-04-22T22:23:02.136Z (about 1 year ago)
- Language: JavaScript
- Size: 290 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WSocket.io Angular Service
The easiest way to integrate wsocket.io into your AngularJS project.
## Browser support
This only supports browsers that come with WebSocket enabled. It has a polyfill for `String.prototype.startsWith()`.
## Simple use
```js
angular.module('myApp', ['angularWsocketIOService'])
.controller('MyController', ['$scope', 'WsocketIOService', function ($scope, WsocketIOService) {
$scope.currentMessage = '';
$scope.response = '';
WsocketIOService.connect();
$scope.sendMessage = function () {
WsocketIOService.send('message', {msg: $scope.currentMessage});
}
WsocketIOService.on('message-back', function (data) {
$scope.response = data.msg;
})
}]);
```