stomp-js / rx-stomp

STOMP adaptor for RxJS
Apache License 2.0
111 stars 21 forks source link

Angular 15 support #487

Closed pantonis closed 1 year ago

pantonis commented 1 year ago

Does this library supports Angular 15?

kum-deepak commented 1 year ago

Not sure. However, the next release should work.

Work is on for the next release for this and the stompjs libraries.

pantonis commented 1 year ago

Any estimate date for 1.2?

kum-deepak commented 1 year ago

I just now released @stomp/rx-stomp@2.0.0-beta1. Please check it with Angular 15.

pantonis commented 1 year ago

Ok will do. any changes that I need to do in the code?

kum-deepak commented 1 year ago

You should not need any changes. In case you do, please report it.

Shamshiel commented 1 year ago

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'

kum-deepak commented 1 year ago

One of the betas introduced this error. I will release one more beta with a fix.

patrik-upspot commented 1 year ago

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}
]
Shamshiel commented 1 year ago

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...

kum-deepak commented 1 year ago

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

kum-deepak commented 1 year ago

Released v2.0.0