Closed cmhampton1021 closed 7 years ago
Your problem lies in the /ws/v11.stomp
part. It has to be /stomp/websocket
. I faced a similar issue when using RabbitMQ
server with the stomp
protocol and /ws/stomp
doesn't work.
I'm confused why that would affect the compiler though. I've updated it to:
this.client = Stomp.client('${scheme}://${environment.messageQueueRootUrl}:${environment.messageQueuePort}/stomp/websocket');
And it still fails compilation.
Here are some screenshots.
I totally misread you there, sorry. Stomp
seems not to be resolved by TS
. How do you import stompjs
?
Just to make you aware, I've written the stompjs
typings just for this.
You can use it now in your devDependecies
section of package.json
like this :"@types/stompjs": "~2.3.0",
and then simply import stompjs
like this: import * as Stomp from 'stompjs';
in your code.
Yep, definitely sounds like the compiler's not picking up the Stomp typings?
@cmhampton1021 Feel free to post your package.json
if you still can't get it to work.
I'm still having the same issue after adding the typings to my package.json file. I appreciate the help, I'm a little late to the party with all this node/npm stuff.
@cmhampton1021 Sorry, but links don't work.
Here's a google drive link.
For every package, you use you need to declare it in dependencies section. Look at the project's package.json
.
Thanks, that seemed to work, mostly. There's apparently something weird about my computer, though. When I initially run ng serve, it fails to compile. But if I remove the service from the constructor of my app component, it recompiles and succeeds. Then I put it back in, and it still works. So it only fails when it does the initial compile.
Also, in my IDE, it still flags that line with an error. I've been using Visual Studio, so I thought that might be the problem. But after switching to Atom, that line is still flagged.
Obviously, you are not declaring providers
properly in app.module.ts
of the project. Every service
you want available in the project needs to be declared there. I suggest you make the effort to read the docs about Angular 2.
I am including the service, thank you very much, and I have read the docs.
providers: [ StompConfigService, STOMPService, ToastService ],
So, nevermind then. I will find another solution to this problem.
I'm not sure if this is the best place to post this, but I'm trying to integrate this into our application and keep getting this error in the angular cli.
It happens on what is line 81 in the stomp.service.ts file (it's on a different line in mine):
// Attempt connection, passing in a callback this.client = Stomp.client('${scheme}://${environment.messageQueueRootUrl}:${environment.messageQueuePort}/ws/v11.stomp');
I had this in another app developed with Angular2 RC4, and it worked perfectly. Now that I'm trying to integrate it into our new platform based on the final release of Angular2, I'm getting this error.Any help would be appreciated.
Chris Hampton