devsullo / ng2-stomp-over-websocket Goto Github PK
View Code? Open in Web Editor NEWSTOMP Over WebSocket service for angular2
Home Page: http://devsullo.com/github/angular2-stomp-over-websocket-service/
License: MIT License
STOMP Over WebSocket service for angular2
Home Page: http://devsullo.com/github/angular2-stomp-over-websocket-service/
License: MIT License
When host is configured , by default when connecting in request ' info' is append in request path, why?
In configuration should be :
host: hostname:port/endPoint
and then subscribe to topic on websocket
Regards, Tomaž
Compatible
Hello, actually I'm working in an project with angular 5, before that I worked with angular 4. But I decided upgraded angular. However the following errors appeared. Does someone has a ide about that?.
Please I need your help.
ERROR in ./node_modules/ng2-stomp-service/dist/stomp.service.ts
Module build failed: Error: /home/jose/projects/OpenMDM-FrontEnd-master/node_modules/ng2-stomp-service/dist/stomp.service.ts is not part of the compilation output. Please check the other error messages for details.
at AngularCompilerPlugin.getCompiledFile (/home/jose/projects/OpenMDM-FrontEnd-master/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:649:23)
at plugin.done.then (/home/jose/projects/OpenMDM-FrontEnd-master/node_modules/@ngtools/webpack/src/loader.js:467:39)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
@ ./node_modules/ng2-stomp-service/index.js 2:20-51
@ ./src/app/devices/devices.module.ts
@ ./src/app/layout/shared/layout.module.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ng2-stomp-service/dist/stomp.service.ts:59:27: Parameter 'config' of public method from exported
class has or is using private name 'Config'.
Hi @devsullo,
this module is really useful, thanks for it.
Please help me, how can i handle the reconnect situation?
My client lifecycle:
--Ben
There is .ts
file in npm package what can cause troubles with some unspecified Typescript compiler config: https://stackoverflow.com/questions/44377617/unable-to-find-typings-d-ts-and-declare-modules-in-angular-2-typescript-app/44380574#44380574
I suggest to add .npmignore
file with the following contents:
*.ts
!*.d.ts
.DS_Store
.DS_Store?
gulpfile.js
/node_modules/*
Thanks in advance for cooperation.
ERROR in ./node_modules/ng2-stomp-service/dist/stomp.service.ts
Module build failed: Error: C:\workspace\spring-boot-angular2-stomp\src\main\ng\node_modules\ng2-stomp-service\dist\stomp.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library
repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile (C:\workspace\spring-boot-angular2-stomp\src\main\ng\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:709:23)
at plugin.done.then (C:\workspace\spring-boot-angular2-stomp\src\main\ng\node_modules@ngtools\webpack\src\loader.js:41:31)
at process._tickCallback (internal/process/next_tick.js:68:7)
Please help me to solve it
Hi,
I'm having an issue with re-connecting. In the web app I'm making, only one page needs a stomp connection. When the user enters that page a stomp connection is made and then a subscription is made. When the user leaves that page, unsubscribe is called, followed by a disconnect. When the user goes back to that page, an InvalidStateError is received when trying to subscribe again.
My code is shown below.
export class MyComponent implement OnInit, OnDestory {
subscription: any;
constructor(private stompService: StompService){}
ngOninit(): void {
this.stompService.configure({
host: "***mystompurl***"
});
this.stompService.startConnect()
.then(() => {
console.log('Stomp connected');
this.subscription = this.stompService.subscribe('/topic/mytopic', (msg, headers) => {
// Message handler code
});
});
}
ngOnDestroy(): void {
if (this.subscription) {
console.log('Unsubscribing');
this.stompService.unsubscribe(this.subscription);
this.subscription = null;
}
this.stompService.disconnect().then(() => console.log('Stomp disconnected');
}
}
The first time the component is initialised everything works fine and messages can be sent and received. When the user leaves the page and the component is destroyed I can see the 'Unsubscribing' and 'Stomp disconnected' console entries.
The second time the user goes into the page and the component is initialised again, I get the 'Stomp connected' console entry, but then I immediately receive the following stack trace.
Error: InvalidStateError: The connection has not been established yet
at ZoneAwareError (http://localhost:4200/polyfills.bundle.js:6988:33)
at SockJS.send (http://localhost:4200/vendor.bundle.js:119988:11)
at Client._transmit (http://localhost:4200/vendor.bundle.js:70078:26)
at Client.subscribe (http://localhost:4200/vendor.bundle.js:70298:12)
at StompService.subscribe (http://localhost:4200/vendor.bundle.js:100552:27)
at http://localhost:4200/main.bundle.js:877:53
at ZoneDelegate.invoke (http://localhost:4200/polyfills.bundle.js:6330:26)
at Object.onInvoke (http://localhost:4200/vendor.bundle.js:4753:37)
at ZoneDelegate.invoke (http://localhost:4200/polyfills.bundle.js:6329:32)
at Zone.run (http://localhost:4200/polyfills.bundle.js:6122:43)
at http://localhost:4200/polyfills.bundle.js:6709:57
at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:6363:31)
at Object.onInvokeTask (http://localhost:4200/vendor.bundle.js:4744:37)
at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:6362:36)
at Zone.runTask (http://localhost:4200/polyfills.bundle.js:6162:47)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.