Registry / messaging / ng2-stomp-service

ng2-stomp-service

JSON →
library1.2.2jsnpmunverified

STOMP Over WebSocket service for Angular 2. Stable version 1.2.2, last released in 2017. No active development or recent updates. Provides a simple service to connect to STOMP brokers over WebSocket (including SockJS) in Angular 2 applications. Key differentiator: built for Angular 2 dependency injection and integrates with RxJS Observables. Now largely superseded by newer libraries and Angular versions.

npm install ng2-stomp-service
INSTALL
IMPORT
SIG · NG2-STOMP-SERVICE
N
ng2-stomp-service
messagingjavascriptv1.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StompService
✓ import { StompService } from 'ng2-stomp-service';
✗ import * as StompService from 'ng2-stomp-service';
Named export; does not support default import.
StompService (TypeScript type use)
✓ import { StompService } from 'ng2-stomp-service';
Same import for both value and type.
require (CommonJS)
✓ const StompService = require('ng2-stomp-service').StompService;
✗ const StompService = require('ng2-stomp-service');
CommonJS require of named export.

Angular service configuration and basic subscribe/send example.

import { StompService } from 'ng2-stomp-service'; import { Injectable } from '@angular/core'; @Injectable() export class MyService { constructor(private stomp: StompService) {} connect() { this.stomp.configure({ host: 'localhost', port: 61614, endpoint: '/ws', login: process.env.STOMP_USER ?? '', passcode: process.env.STOMP_PASS ?? '', debug: true }); this.stomp.startConnect().then(() => { console.log('connected'); this.stomp.subscribe('/queue/test', (msg) => { console.log(msg); }); }); } send() { this.stomp.send('/queue/test', { data: 'hello' }); } }
Debug
Known issues
deprecatedLibrary is no longer maintained. It targets Angular 2 and may not work with Angular 4+.
fix
Migrate to a maintained library like @stomp/stompjs or angular-stomp.
affects: >=1.0.0
breakingUses Angular 2 lifecycle hooks; Angular 4+ changed module/component patterns.
fix
Update to Angular compatible version or switch libraries.
affects: >=2.0.0
gotchaRequires RxJS Observable; if using RxJS 6+, operators may need to be piped.
fix
Use lettable operators (pipe) with RxJS 6+.
affects: >=1.0.0
gotchaSockJS sessions not automatically disconnected on page unload; may cause resource leaks.
fix
Manually unsubscribe in ngOnDestroy.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Can't resolve 'rxjs/add/operator/map'
Library imports patched RxJS operators; RxJS 6+ removed them.
fix
Update to RxJS 5 or use pipeable operators and adjust import.
Error: No provider for StompService!
StompService must be provided in a module or component.
fix
Add StompService to providers array in NgModule.
TypeError: this.stomp.startConnect is not a function
Incorrect import or stale library version.
fix
Ensure import is correct, and configure before calling startConnect.
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies
@angular/corerequiredPeer dependency for Angular 2.
rxjsrequiredUses RxJS Observables for message streams.
sockjs-clientoptionalOptional: used when connecting via SockJS.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
ng2-stomp-service — npm install ng2-stomp-service · libregistry