Skip to content
This repository has been archived by the owner on Nov 13, 2018. It is now read-only.

Latest commit

 

History

History
62 lines (43 loc) · 2.06 KB

README.md

File metadata and controls

62 lines (43 loc) · 2.06 KB

@stomp/ng2-stompjs Angular 2 Demo App

A demo application using Angular 2 in Typescript and @stomp/ng2-stompjs, generated with angular-cli.

This application uses APP_INITIALIZER to load configuration settings for STOMP. Using APP_INITIALIZER ensures that Angular application will instantiate the StompService until the config is fetched from the designated HTTP location. It uses a set of libraries https://github.com/ngx-config/core and https://github.com/ngx-config/http-loader that simplies the whole mechanism.

This is a forked version of https://github.com/sjmf/ng2-stompjs-demo

Setup

Install dependencies:

$ npm install

or, if using yarn

$ yarn

Configure details for your Stomp Broker by editing src/api/config.json

The configuration should work as is for a RabbitMQ instance running on localhost with default settings and Web STOMP plugin activated. (see: https://www.rabbitmq.com/web-stomp.html).

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Where Next

Check the following files:

  • src/app/factories/config-loader.factory.ts - Go here to configure backend HTTP endpoint/path to fetch the configuration.
  • src/app/app.module.ts and src/app/factories/stomp-config.factory.ts - Service provisions for Dependency Injection.
  • src/app/components/rawdata/rawdata.component.ts - subscribing / unsubscribing a queue and publishing messages.
  • src/app/components/status/status.component.ts - monitoring status of Stomp connection.

Contributors

License

MIT