Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beevelop/ng-stomp
:bookmark_tabs: STOMP for AngularJS
https://github.com/beevelop/ng-stomp
angularjs bower npm sockjs stomp
Last synced: about 2 months ago
JSON representation
:bookmark_tabs: STOMP for AngularJS
- Host: GitHub
- URL: https://github.com/beevelop/ng-stomp
- Owner: beevelop
- License: mit
- Created: 2015-03-08T11:00:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-07T16:07:31.000Z (almost 7 years ago)
- Last Synced: 2024-10-09T22:34:28.546Z (3 months ago)
- Topics: angularjs, bower, npm, sockjs, stomp
- Language: JavaScript
- Homepage: http://beevelop.github.io/stomp-ui/
- Size: 118 KB
- Stars: 43
- Watchers: 7
- Forks: 43
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/ng-stomp.svg?style=flat-square)](https://www.npmjs.com/package/ng-stomp)
[![Travis](https://img.shields.io/travis/beevelop/ng-stomp.svg?style=flat-square)](https://travis-ci.org/beevelop/ng-stomp)
[![Maintainability](https://api.codeclimate.com/v1/badges/cbb91c2e42568f6889b7/maintainability)](https://codeclimate.com/github/beevelop/ng-stomp/maintainability)
[![Gemnasium](https://img.shields.io/gemnasium/beevelop/ng-stomp.svg?style=flat-square)](https://gemnasium.com/beevelop/ng-stomp)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
[![Beevelop](https://links.beevelop.com/honey-badge)](https://beevelop.com)# ngStomp
> [STOMP](http://jmesnil.net/stomp-websocket/doc/) promised for [AngularJS](https://angularjs.org)
## Installation
### Install via npm:
```bash
npm install --save ng-stomp
```#### Add standalone version (dependencies included) to your HTML file
```html```
#### Or add SockJS + STOMP + (minified) Stompie individually:
```html```
----## Usage
Inject it in your controller:
```js
angular
// Declare ngStomp as a dependency for you module
.module('app', ['ngStomp'])// use $stomp in your controllers, services, directives,...
.controller('Ctrl', function ($stomp, $scope, $log) {
$stomp.setDebug(function (args) {
$log.debug(args)
})$stomp
.connect('/endpoint', connectHeaders)// frame = CONNECTED headers
.then(function (frame) {
var subscription = $stomp.subscribe('/dest', function (payload, headers, res) {
$scope.payload = payload
}, {
'headers': 'are awesome'
})// Unsubscribe
subscription.unsubscribe()// Send message
$stomp.send('/dest', {
message: 'body'
}, {
priority: 9,
custom: 42 // Custom Headers
})// Disconnect
$stomp.disconnect().then(function () {
$log.info('disconnected')
})
})
})
```## API-Docs (TBD)
- setDebug(callback)
- connect(endpoint, headers)
- disconnect
- subscribe(destination, callback, headers)
- on(destination, callback, headers)
- unsubscribe(subscription)
- off(subscription)
- send(destination, body, headers)## Breaking changes
- Bower support has been removed from `v0.5.0` onwards. Please switch to npm / yarn.