Closed pantonis closed 1 year ago
Not sure. However, the next release should work.
Work is on for the next release for this and the stompjs libraries.
Any estimate date for 1.2?
I just now released @stomp/rx-stomp@2.0.0-beta1. Please check it with Angular 15.
Ok will do. any changes that I need to do in the code?
You should not need any changes. In case you do, please report it.
Using the 2.0.0-beta1
release I get the following error with Angular 15:
./node_modules/@stomp/stompjs/esm6/tcp-wrapper.js:1:0-39 - Error: Module not found: Error: Can't resolve 'net' in '/home/user123/repository/project/node_modules/@stomp/stompjs/esm6'
One of the betas introduced this error. I will release one more beta with a fix.
I wanted to use rsStomp with Angular 15 too, but i get a error:
Error: src/app/core/services/stomp/rx-stomp.service.ts:7:14 - error NG2006: The injectable RxStompService inherits its constructor from RxStomp, but the latter does not have an Angular decorator of its own. Dependency injection will not be able to resolve the parameters of RxStomp's constructor. Either add a @Injectable decorator to RxStomp, or add an explicit constructor to RxStompService.
my rx-stomp.serice.ts:
import { Injectable } from '@angular/core';
import { RxStomp } from '@stomp/rx-stomp';
@Injectable({
providedIn: 'root',
})
export class RxStompService extends RxStomp {}
I tested the latest stable and the latest beta.
my app.modules.ts
providers: [
{provide: RxStompService,useFactory: rxStompServiceFactory}
]
One of the betas introduced this error. I will release one more beta with a fix.
Thanks for the beta2 release, the error is gone but like @patrik-upspot I have the following error now:
Error: src/app/service/rx-stomp.service.ts:7:14 - error NG2006: The injectable RxStompService inherits its constructor from RxStomp, but the latter does not have an Angular decorator of its own. Dependency injection will not be able to resolve the parameters of RxStomp's constructor. Either add a @Injectable decorator to RxStomp, or add an explicit constructor to RxStompService.
7 export class RxStompService extends RxStomp {}
It is fixable by addind an empty constructor like this
import { Injectable } from '@angular/core';
import { RxStomp } from '@stomp/rx-stomp';
@Injectable({
providedIn: 'root'
})
export class RxStompService extends RxStomp {
constructor() {
super();
}
}
But this seems wrong because like this the stompClient is most likely not passed to RxStomp...
This is the correct solution. The stomp client is optional, and passing is useful only for debugging or testing. The guides have been updated - https://stomp-js.github.io/guide/rx-stomp/rx-stomp-with-angular.html#the-rxstompservice
I have also created a new sample with Angular 15 - https://github.com/stomp-js/rx-stomp-angular15
Released v2.0.0
Does this library supports Angular 15?