ng2-stompjs | Angular 6 and 7 - Stomp service over Websockets | Websocket library
kandi X-RAY | ng2-stompjs Summary
kandi X-RAY | ng2-stompjs Summary
Angular 6 and 7 - Stomp service over Websockets
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ng2-stompjs
ng2-stompjs Key Features
ng2-stompjs Examples and Code Snippets
Community Discussions
Trending Discussions on ng2-stompjs
QUESTION
I am using ws (non secured WebSocket) in a Spring Boot application. Once the client tries to connect to the server the following error appears:
Handshake failed due to invalid Upgrade header: null
The spring boot app runs on an Ubuntu server behind an Apache proxy. Apache is configured as follows:
...ANSWER
Answered 2020-Nov-28 at 19:11I finally managed to find the error. The order of statements in the apache.conf
does matter! The working conf file looks like so:
QUESTION
ERROR in src/app/components/dashboard/dashboard.component.html:1:1 - error NG8001: 'StackLayout' is ot a known element:
- If 'StackLayout' is an Angular component, then verify that it is part of this module.
- To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
1
dashboard.component.tns.html
...ANSWER
Answered 2020-Oct-13 at 18:48Just realized the app.module.tns.ts doesn't have the Dashboard component declared which resolves the issue.
QUESTION
I have been researching for a way to limit the number of clients who can subscribe to a specific stomp topic but have not yet understood, which could be the right approach according to my needs.
My use case is a game, which I am developing in Angular (ng2-stompjs stomp client) and Spring Boot Websockets (for the moment, the Spring in-memory message broker is in use).
The idea is that a user can be connected and subscribed to a "/lobby" stomp topic, and there he sees the opened game rooms, that could be in different statuses. for example, in-play or not started yet due to the low number of players joined. I'd like to intercept and programmatically restrict a possible subscription of a client, to a specific "/room/{roomId}" topic, IF the MAX number of players has been reached, for example, 4. There could also be some simple client-side validation to restrict that, but I believe only client-side is not sufficient
So my main questions are: How can a specific stomp topic subscription be intercepted in Spring? Is it possible to return to the client-requestor some kind of error message that subscription could not be done?
I'd really appreciate your help, thank you in advance!
...ANSWER
Answered 2020-Jun-29 at 04:23You could implement a StompEventListener which listens for subscriptions, in this we can have map mapping a destination(room number) versus the count of number of players in that particular room. if the count is already at max reject the subscription.
QUESTION
I am trying to build a angular client that uses websockets, and I am using @stomp/ng2-stompjs I am following this guide https://stomp-js.github.io/guide/ng2-stompjs/ng2-stomp-with-angular7.html
Everything works perfectly except that I need to set in the connectHeaders the token that I use to authenticate server side, to do this I read that I need to use the function beforeConnect
I tried in various way but I don't understand how to use it, it gets stuck or it sends a empty token
My rxStompConfig:
export class RxStompConfig extends InjectableRxStompConfig {
...ANSWER
Answered 2020-Apr-05 at 11:44Check this one
https://github.com/stomp-js/rx-stomp/issues/204
There was a fix that should solve your issue. Basically now in the beforeConnect you can receive the stompClient that can be configured and in your particular case you will be able to set the connectHeaders
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ng2-stompjs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page