Skip to content
Angular service to Web-Stomp
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Angular service to Web-Stomp


This class relies on stomp.js that can be found at:

  1. Set the socket provider for Stomp. I do this in my app config: Stomp.WebSocketClass = SockJS; (Here I am using SockJS: <script src=""></script>)
  2. In your app module add 'AngularStomp'. The name of the injected service is ngstomp
  3. The service is a constructor that takes the url to connect to. Here is a full example:
function FrontPageController($scope, $routeParams, ngstomp) {
    $scope.messages = [];
    $scope.client = ngstomp('http://localhost:15674/stomp');
    $scope.client.connect("guest", "guest", function(){
        $scope.client.subscribe("/topic/test", function(message) {
    }, function(){}, '/');

Example HTML:

<div class="row" ng-controller="FrontPageController">
    <div class="span8 offset1">
        <p ng-repeat="message in messages">{{message}}</p>
You can’t perform that action at this time.