Websocket Postman

I just wanted to check if someone notice anything wrong in my code. Basically, what I want to do is that when a new user registers, I want the admins to be notified with "New user has been registered", but I want to do it in real-time using WebSocket. I'm testing my WebSocket URL ws://localhost:8080/ws, and I successfully connect to it. I also subscribe to the destination:
destination:/topic/admins
id:sub-0
destination:/topic/admins
id:sub-0
which works fine. But when I register a new user, I don't receive the message in the destination, even though I see it in the terminal 😅 hahaha. It's weird, but I just wanted to check if someone notice anything off. WebsocketConfig
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws")
.setAllowedOrigins("*");
}

@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic");
registry.setApplicationDestinationPrefixes("/app");
}
}
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws")
.setAllowedOrigins("*");
}

@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic");
registry.setApplicationDestinationPrefixes("/app");
}
}
NotificationService
@Service
public class NotificationService {

private static final Logger logger = LoggerFactory.getLogger(NotificationService.class);
private final SimpMessagingTemplate messagingTemplate;

public NotificationService(SimpMessagingTemplate messagingTemplate) {
this.messagingTemplate = messagingTemplate;
}

public void notifyAdmin(String message) {
logger.info("Sending WebSocket message to /topic/admins: {}", message);
messagingTemplate.convertAndSend("/topic/admins", message);
logger.info(" WebSocket message sent successfully!");
}
}
@Service
public class NotificationService {

private static final Logger logger = LoggerFactory.getLogger(NotificationService.class);
private final SimpMessagingTemplate messagingTemplate;

public NotificationService(SimpMessagingTemplate messagingTemplate) {
this.messagingTemplate = messagingTemplate;
}

public void notifyAdmin(String message) {
logger.info("Sending WebSocket message to /topic/admins: {}", message);
messagingTemplate.convertAndSend("/topic/admins", message);
logger.info(" WebSocket message sent successfully!");
}
}
AuthService
User user = createUser(request);
userRepository.save(user);

System.out.println("User registered: " + user.getFirstname() + " " + user.getLastname());

notificationService.notifyAdmin("New user registered: " + user.getFirstname() + " " + user.getLastname());
System.out.println(" WebSocket message sent for user registration!");

return ResponseEntity.status(HttpStatus.CREATED)
.body(new AuthenticationResponse("User successfully registered"));
User user = createUser(request);
userRepository.save(user);

System.out.println("User registered: " + user.getFirstname() + " " + user.getLastname());

notificationService.notifyAdmin("New user registered: " + user.getFirstname() + " " + user.getLastname());
System.out.println(" WebSocket message sent for user registration!");

return ResponseEntity.status(HttpStatus.CREATED)
.body(new AuthenticationResponse("User successfully registered"));
121 Replies
JavaBot
JavaBot•3d ago
⌛ This post has been reserved for your question.
Hey @Itsurran! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Itsurran
ItsurranOP•3d ago
Anyone please 🙂
ayylmao123xdd
ayylmao123xdd•3d ago
wazaaaaaaaaaaaaaaaaap
Itsurran
ItsurranOP•3d ago
How you doing
ayylmao123xdd
ayylmao123xdd•3d ago
great show the code where u register to endpoint
Itsurran
Itsurran•3d ago
’’’java @PostMapping("/register")
public ResponseEntity<AuthenticationResponse> register(@RequestBody RegisterRequest request) {
return authenticationService.register(request);
}
public ResponseEntity<AuthenticationResponse> register(@RequestBody RegisterRequest request) {
return authenticationService.register(request);
}
’’’
This message has been formatted automatically. You can disable this using /preferences.
Itsurran
ItsurranOP•3d ago
Ugg I’m on my phone
ayylmao123xdd
ayylmao123xdd•3d ago
no no oh you use postman wait let me ask
Itsurran
ItsurranOP•3d ago
@PostMapping("/register")
public ResponseEntity<AuthenticationResponse> register(@RequestBody RegisterRequest request) {
return authenticationService.register(request);
}
@PostMapping("/register")
public ResponseEntity<AuthenticationResponse> register(@RequestBody RegisterRequest request) {
return authenticationService.register(request);
}
yea for my endpoints
ayylmao123xdd
ayylmao123xdd•3d ago
hmmmmm r u sure ur listening to the correct destination on postman
Itsurran
ItsurranOP•3d ago
As you can se on this picture You can se the terminal that the user registartion has been registered but im not getting back any message
No description
Itsurran
ItsurranOP•3d ago
th
public void notifyAdmin(String message) {
logger.info(" Sending WebSocket message to /topic/admins: {}", message);
messagingTemplate.convertAndSend("/topic/admins", message);
logger.info(" WebSocket message sent successfully!");
}
public void notifyAdmin(String message) {
logger.info(" Sending WebSocket message to /topic/admins: {}", message);
messagingTemplate.convertAndSend("/topic/admins", message);
logger.info(" WebSocket message sent successfully!");
}
ayylmao123xdd
ayylmao123xdd•3d ago
so in my app on the frontend to listen to the channel i had to do
ws://localhost:8080/ws
ws://localhost:8080/ws
and to listen to the port
Itsurran
ItsurranOP•3d ago
yes, that is the connection but since i want to land on a destination for example in my case notifciations where admins can see that there has been a new user registered then i should do this
SUBSCRIBE
destination:/topic/admins
id:sub-0
SUBSCRIBE
destination:/topic/admins
id:sub-0
ayylmao123xdd
ayylmao123xdd•3d ago
ws://localhost:8080/ws/topic/admins
ws://localhost:8080/ws/topic/admins
that should be ur example url try that
Itsurran
ItsurranOP•3d ago
cant connect
No description
ayylmao123xdd
ayylmao123xdd•3d ago
yea but you need to use your actual destination if ur using some other ip
Itsurran
ItsurranOP•3d ago
wym
ayylmao123xdd
ayylmao123xdd•3d ago
oh nvm
Itsurran
ItsurranOP•3d ago
we need danial in here is a pro :JoyStroke:
ayylmao123xdd
ayylmao123xdd•3d ago
yea call his sudoness here say 'your sudoness we have been awaiting you' :GnuTrolling:
Itsurran
ItsurranOP•3d ago
@dan1st :/ sry for pining you but you gotta be involved
dan1st
dan1st•3d ago
test ok Discord seems to somewhat work again seems like they have an issue with Google Cloud at east accessing Discord results in a Google Cloud error
upstream connect error or disconnect/reset before headers. reset reason: overflow
Itsurran
ItsurranOP•3d ago
me 2 couldnt load servers
dan1st
dan1st•3d ago
yes ik it's a Discord issue
dan1st
dan1st•3d ago
Postman Docs
Create a WebSocket Request | Postman Docs
Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.
dan1st
dan1st•3d ago
for Websocket requests
dan1st
dan1st•3d ago
specifically that thing
No description
Itsurran
ItsurranOP•3d ago
yh i have
No description
dan1st
dan1st•3d ago
Can you expand these things?
No description
Itsurran
ItsurranOP•3d ago
oh i was just testing with different SUBSCRIBE but this is the right one
No description
Itsurran
ItsurranOP•3d ago
oh i meant here
dan1st
dan1st•3d ago
looks fine so far
Itsurran
ItsurranOP•3d ago
right but someone is not sending me the message to that destiantion
ayylmao123xdd
ayylmao123xdd•3d ago
maybe postman api is just bad for websockets
Itsurran
ItsurranOP•3d ago
anywhere else to try?
dan1st
dan1st•3d ago
use a proper client like the actual client that is supposed to connect
Itsurran
ItsurranOP•3d ago
You mean a frontend? for it
dan1st
dan1st•3d ago
for example - I assume you already have one?
Itsurran
ItsurranOP•3d ago
Not yet, doing backend first
dan1st
dan1st•3d ago
ah ok
Itsurran
ItsurranOP•3d ago
apis, logics etc then starting with client
dan1st
dan1st•3d ago
Well, what is supposed to happen?
Itsurran
ItsurranOP•3d ago
lemme se if there is plugin in intellij for websocket So when a new user registeres i want the admins to be notified in real time that theres a new user registered
dan1st
dan1st•3d ago
so you have the websocket connection where the admin is supposed to be notified? Just try to register a user and see what happens? Also use a debugger to see what's executed on the Java side Is there any way an admin authenticates themselves on the websocket?
Itsurran
ItsurranOP•3d ago
i mean im prolly gonna use websocket for alot of things but its nice to have every detail
dan1st
dan1st•3d ago
(before being allowed to receive events)
Itsurran
ItsurranOP•3d ago
No not yet, can it be that?
dan1st
dan1st•3d ago
so you are automatically sending the events to all connected clients? Do you have a listener or similar for incoming websocket connections?
Itsurran
ItsurranOP•3d ago
Yes but they are gonna be specifc to admins only to connect Nope
dan1st
dan1st•3d ago
What stops a non-admin from connecting? then maybe create one and see whether it's called
Itsurran
ItsurranOP•3d ago
Alright 1 sec
dan1st
dan1st•3d ago
Are you using STOMP?
Itsurran
ItsurranOP•3d ago
yes
dan1st
dan1st•3d ago
ok that's not normal websockets - that's something built on top of websockets so just connecting via postman doesn't make you get the events I think actually nvm I think that should work if the URL is correct
Itsurran
ItsurranOP•3d ago
like this is the only code i have right now thats connect for websocket
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws")
.setAllowedOrigins("*");
}

@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic");
registry.setApplicationDestinationPrefixes("/app");
}
}
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws")
.setAllowedOrigins("*");
}

@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic");
registry.setApplicationDestinationPrefixes("/app");
}
}
and
@Service
public class NotificationService {

private static final Logger logger = LoggerFactory.getLogger(NotificationService.class);
private final SimpMessagingTemplate messagingTemplate;

public NotificationService(SimpMessagingTemplate messagingTemplate) {
this.messagingTemplate = messagingTemplate;
}

public void notifyAdmin(String message) {
logger.info(" Sending WebSocket message to /topic/admins: {}", message);
messagingTemplate.convertAndSend("/topic/admins", message);
logger.info(" WebSocket message sent successfully!");
}

public void sendTestMessage() {
String testMessage = "{\"message\": \"🚀 WebSocket Test: Hello from Spring Boot!\"}";
messagingTemplate.convertAndSend("/topic/admins", testMessage);
logger.info(" Sent WebSocket test message: " + testMessage);
}
}
@Service
public class NotificationService {

private static final Logger logger = LoggerFactory.getLogger(NotificationService.class);
private final SimpMessagingTemplate messagingTemplate;

public NotificationService(SimpMessagingTemplate messagingTemplate) {
this.messagingTemplate = messagingTemplate;
}

public void notifyAdmin(String message) {
logger.info(" Sending WebSocket message to /topic/admins: {}", message);
messagingTemplate.convertAndSend("/topic/admins", message);
logger.info(" WebSocket message sent successfully!");
}

public void sendTestMessage() {
String testMessage = "{\"message\": \"🚀 WebSocket Test: Hello from Spring Boot!\"}";
messagingTemplate.convertAndSend("/topic/admins", testMessage);
logger.info(" Sent WebSocket test message: " + testMessage);
}
}
little bit here at authservice
User user = createUser(request);
userRepository.save(user);

System.out.println("User registered: " + user.getFirstname() + " " + user.getLastname());

notificationService.notifyAdmin("New user registered: " + user.getFirstname() + " " + user.getLastname());
System.out.println(" WebSocket message sent for user registration!");

return ResponseEntity.status(HttpStatus.CREATED)
.body(new AuthenticationResponse("User successfully registered"));
}
User user = createUser(request);
userRepository.save(user);

System.out.println("User registered: " + user.getFirstname() + " " + user.getLastname());

notificationService.notifyAdmin("New user registered: " + user.getFirstname() + " " + user.getLastname());
System.out.println(" WebSocket message sent for user registration!");

return ResponseEntity.status(HttpStatus.CREATED)
.body(new AuthenticationResponse("User successfully registered"));
}
dan1st
dan1st•3d ago
is the logger.info("Sending WebSocket message to /topic/admins: {}", message); printed? yeah I think you need to do something like that
Itsurran
ItsurranOP•3d ago
this happens when i start the project without connecting
No description
dan1st
dan1st•3d ago
What happens when sending the SUBSCRIBE message in postman?
Itsurran
ItsurranOP•3d ago
weird right?
dan1st
dan1st•3d ago
Where does that come from?
No description
Itsurran
ItsurranOP•3d ago
from my authservice just to log
dan1st
dan1st•3d ago
you see the arrow/caret on the right? What happens when clicking it?
No description
Itsurran
ItsurranOP•3d ago
it folds the message
Itsurran
ItsurranOP•3d ago
No description
dan1st
dan1st•3d ago
ah so it happens when the user is registered
Itsurran
ItsurranOP•3d ago
yes that message only comes when the user is registered
Itsurran
ItsurranOP•3d ago
No description
dan1st
dan1st•3d ago
Are you using Spring Security?
Itsurran
ItsurranOP•3d ago
yes
dan1st
dan1st•3d ago
Can you show the config?
Itsurran
ItsurranOP•3d ago
absolutly
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfiguration {

private final AuthenticationProvider authenticationProvider;
private final UserSessionService userSessionService;
private final UserDetailsService userDetailsService;
private final LogoutService logoutService;

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeHttpRequests()
.requestMatchers("/api/v1/auth/**").permitAll()
.requestMatchers("/**").permitAll()
.anyRequest().authenticated()
.and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) // Disable default session creation
.and()
.authenticationProvider(authenticationProvider)
.addFilterBefore(new SessionAuthenticationFilter(userSessionService), UsernamePasswordAuthenticationFilter.class)
.logout()
.logoutUrl("/api/v1/auth/logout")
.addLogoutHandler(logoutService)
.logoutSuccessHandler((request, response, authentication) -> SecurityContextHolder.clearContext());
return http.build();
}

@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.addAllowedOrigin("http://localhost:5173");
config.addAllowedHeader("*");
config.setAllowCredentials(true);
config.addAllowedMethod("*");
source.registerCorsConfiguration("/api/v1/auth/**", config);
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfiguration {

private final AuthenticationProvider authenticationProvider;
private final UserSessionService userSessionService;
private final UserDetailsService userDetailsService;
private final LogoutService logoutService;

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeHttpRequests()
.requestMatchers("/api/v1/auth/**").permitAll()
.requestMatchers("/**").permitAll()
.anyRequest().authenticated()
.and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) // Disable default session creation
.and()
.authenticationProvider(authenticationProvider)
.addFilterBefore(new SessionAuthenticationFilter(userSessionService), UsernamePasswordAuthenticationFilter.class)
.logout()
.logoutUrl("/api/v1/auth/logout")
.addLogoutHandler(logoutService)
.logoutSuccessHandler((request, response, authentication) -> SecurityContextHolder.clearContext());
return http.build();
}

@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.addAllowedOrigin("http://localhost:5173");
config.addAllowedHeader("*");
config.setAllowCredentials(true);
config.addAllowedMethod("*");
source.registerCorsConfiguration("/api/v1/auth/**", config);
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}
dan1st
dan1st•3d ago
I assume the .requestMatchers("/**").permitAll() is just for debugging?
Itsurran
ItsurranOP•3d ago
yep but gonna strict all of these later with @HasAuthorize etc
dan1st
dan1st•3d ago
I personally prefer restricting them in the security config but your choice how to do it
Itsurran
ItsurranOP•3d ago
yh i will se that later just wanted to get webscoket up because ive had problem with it alot
dan1st
dan1st•3d ago
Can you try something like this? https://stackoverflow.com/q/49980319/10871900
Stack Overflow
Send message to client on connect via Spring Websocket
Okay, I have practically read every single stackoveflow post on spring websocket. I want to send a message to a particular client once it connects to the server, simple! I have been able to connect
dan1st
dan1st•3d ago
and also log something there For example
@Component
public class StompConnectEventListener implements ApplicationListener<SessionSubscribeEvent> {

private static final Logger logger = LoggerFactory.getLogger(NotificationService.class);
private final SimpMessagingTemplate messagingTemplate;

public StompConnectEventListener(SimpMessagingTemplate messagingTemplate){
this.messagingTemplate = messagingTemplate;
}

public void onApplicationEvent(SessionSubscribeEvent event) {
logger.info("CONNECT {}", event);
this.messagingTemplate.convertAndSend("/topic/admins", "Hello World");
}
}
@Component
public class StompConnectEventListener implements ApplicationListener<SessionSubscribeEvent> {

private static final Logger logger = LoggerFactory.getLogger(NotificationService.class);
private final SimpMessagingTemplate messagingTemplate;

public StompConnectEventListener(SimpMessagingTemplate messagingTemplate){
this.messagingTemplate = messagingTemplate;
}

public void onApplicationEvent(SessionSubscribeEvent event) {
logger.info("CONNECT {}", event);
this.messagingTemplate.convertAndSend("/topic/admins", "Hello World");
}
}
Itsurran
ItsurranOP•3d ago
What about this
4

I haven't found a solution yet, but I found an alternative that works. So, instead of listening for SessionConnectedEvent, I added a controller method that gets fired when a user subscribes to it.

See below.
4

I haven't found a solution yet, but I found an alternative that works. So, instead of listening for SessionConnectedEvent, I added a controller method that gets fired when a user subscribes to it.

See below.
dan1st
dan1st•3d ago
you can also try that if you want to or both so adding
@SubscribeMapping("/topic/admins")
public String initialReply() throws Exception {
logger.info("SUBSCRIBE in controller");
return "Response from controller";
}
@SubscribeMapping("/topic/admins")
public String initialReply() throws Exception {
logger.info("SUBSCRIBE in controller");
return "Response from controller";
}
might do something as well I'd just try both and see what happens so add them, try subscribing from postman and check for a response - and also check the logs from Spring
Itsurran
ItsurranOP•3d ago
Same results as the picture i sent this is weird wanna try urself? i can send u the zip and just add a new db in application.properties mby its my postman 😂
dan1st
dan1st•3d ago
so no logs in Spring? Then I guess your subscription message is incorrect
Itsurran
ItsurranOP•3d ago
like i only get this User registered: John Doe 2025-02-04T23:04:49.951+01:00 INFO 33732 --- [nio-8080-exec-3] NEMportal.service.NotificationService : Sending WebSocket message to /topic/admins: New user registered: John Doe 2025-02-04T23:04:49.954+01:00 INFO 33732 --- [nio-8080-exec-3] NEMportal.service.NotificationService : WebSocket message sent successfully! WebSocket message sent for user registration! when i register a user
dan1st
dan1st•3d ago
You could try creating a new HTML page with very little JS that just uses stompjs to subscribe Are there any logs when subscribing?
Itsurran
ItsurranOP•3d ago
no logs
dan1st
dan1st•3d ago
I am not talking about the user creation but the subscribing thing
Itsurran
ItsurranOP•3d ago
nope
dan1st
dan1st•3d ago
And you added both pieces of code to your project? Can you show the directory structure of your backend? i.e. the folders and files, specifically Java files
Itsurran
ItsurranOP•3d ago
No description
dan1st
dan1st•3d ago
ok yeah try it with Stompjs or similar
Itsurran
ItsurranOP•3d ago
cant even connect
No description
Itsurran
ItsurranOP•3d ago
and thats a frontend problem :/ ugh why this gotta be complicated
dan1st
dan1st•3d ago
Can you check the network tab?
Itsurran
ItsurranOP•3d ago
No description
Itsurran
ItsurranOP•3d ago
No description
dan1st
dan1st•3d ago
Does anything appear in the network tab when attempting to connect?
Itsurran
ItsurranOP•3d ago
yes
Itsurran
ItsurranOP•3d ago
No description
dan1st
dan1st•3d ago
Can you show the messages tabs of the individual requests there? Did you press the button multiple times?
Itsurran
ItsurranOP•3d ago
yes
dan1st
dan1st•3d ago
ah ok can you show the messages tab? in the devtools If postman doesn't work, you can use the HTML page instead of postman xd
Itsurran
ItsurranOP•3d ago
nothing
No description
dan1st
dan1st•3d ago
Does the "Response headers" show anything there?
Itsurran
ItsurranOP•3d ago
nope nothing
dan1st
dan1st•3d ago
Can you show the JS? I feel like you might have done something weird with the URL
Itsurran
ItsurranOP•3d ago
it's simple connection
function connect() {
let socket = new WebSocket("ws://localhost:8080/ws");
stompClient = Stomp.over(socket);

stompClient.connect({}, function (frame) {
document.getElementById("status").innerText = "Connected";
console.log(" Connected to WebSocket:", frame);

// Subscribe to /topic/admins
stompClient.subscribe("/topic/admins", function (message) {
console.log(" New WebSocket Message Received:", message.body);

let response = JSON.parse(message.body);
let li = document.createElement("li");
li.textContent = " " + response.message;
document.getElementById("messages").appendChild(li);
});
}, function (error) {
console.error(" WebSocket Connection Error:", error);
document.getElementById("status").innerText = "Error";
});
}

function disconnect() {
if (stompClient !== null) {
stompClient.disconnect();
document.getElementById("status").innerText = "Disconnected";
console.log(" Disconnected from WebSocket");
}
}
function connect() {
let socket = new WebSocket("ws://localhost:8080/ws");
stompClient = Stomp.over(socket);

stompClient.connect({}, function (frame) {
document.getElementById("status").innerText = "Connected";
console.log(" Connected to WebSocket:", frame);

// Subscribe to /topic/admins
stompClient.subscribe("/topic/admins", function (message) {
console.log(" New WebSocket Message Received:", message.body);

let response = JSON.parse(message.body);
let li = document.createElement("li");
li.textContent = " " + response.message;
document.getElementById("messages").appendChild(li);
});
}, function (error) {
console.error(" WebSocket Connection Error:", error);
document.getElementById("status").innerText = "Error";
});
}

function disconnect() {
if (stompClient !== null) {
stompClient.disconnect();
document.getElementById("status").innerText = "Disconnected";
console.log(" Disconnected from WebSocket");
}
}
hahahah like what? I'm telling you, i can send you the zip of the code and you just run it and see. Maybe its my shit thats not working 😂 So what we thinking, the next move 😦 Should I create another destination and something else just to try?
dan1st
dan1st•3d ago
idk about setting it up like that - if I were, I'd create a new project and add all the necessary stuff myself I guess stompClient = Stomp.client("ws://localhost:8080/ws"); instead of the thing with WebSocket and Stomp.over results in the same error? or stompClient = Stomp.overWS("ws://localhost:8080/ws");
Itsurran
ItsurranOP•3d ago
lemme try 1 sec got it working
Itsurran
ItsurranOP•3d ago
@dan1st
No description
dan1st
dan1st•3d ago
What was the issue? The backend or frontend/Postman side?
Itsurran
ItsurranOP•3d ago
first i tried ur way then it say origin not allowed and i added the origin and some stuff on corsfilter and it worked
dan1st
dan1st•3d ago
then I guess the backend works perfectly fine and it was just postman because CORS restrictions are specifically for web browsers
Itsurran
ItsurranOP•3d ago
yep got it
No description
Itsurran
ItsurranOP•3d ago
alright guess backend works perfectly
dan1st
dan1st•3d ago
maybe you made a typo in postman or whatever btw I wouldn't even have made that much stuff in the HTML page - I would have just logged the things I needed to the console and always change in the page what I currently need to test lol or just write automated tests in Java
Itsurran
ItsurranOP•3d ago
Never done that 😮 in school we only learned postman and html tests l0l
dan1st
dan1st•3d ago
something similar to https://rafaelhz.github.io/testing-websockets/ I guess I also never properly worked with websockets lol
Itsurran
ItsurranOP•3d ago
hate it
JavaBot
JavaBot•2d ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?