Hi thank you for your video. It helps a lot. I use Gradle instead of Maven for my project. I was trying to add this real time chat feature to my project, but I get this error message. "EventSource's response has a MIME type ("application/json") that is not "text/event-stream". Aborting the connection." And it seems that WebSocket connection fails because of this error. I modified my WebConfig and WebsocketConfig accordingly, but I still have the same error. Do you have any suggestions or idea what might have triggered this issue?
I don't exactly know, but I figured it out. my jwt token was the issue so I implemented HandshakeInterceptor and created WebsocketHandshakeInterceptor. Again, thanks for your video as it helped me to gain much insight of overall websocket and how it works. thanks!!
Nice video! It would be awesome if you also add a link to the github repository. Really good content tho keep it up!
Sure, thank you!
github.com/Algol22/JavaWebSocketReact
Hi thank you for your video. It helps a lot.
I use Gradle instead of Maven for my project.
I was trying to add this real time chat feature to my project, but I get this error message.
"EventSource's response has a MIME type ("application/json") that is not "text/event-stream". Aborting the connection."
And it seems that WebSocket connection fails because of this error.
I modified my WebConfig and WebsocketConfig accordingly, but I still have the same error.
Do you have any suggestions or idea what might have triggered this issue?
I don't exactly know, but I figured it out. my jwt token was the issue so I implemented HandshakeInterceptor and created WebsocketHandshakeInterceptor. Again, thanks for your video as it helped me to gain much insight of overall websocket and how it works. thanks!!
I got an error
Not working
Sir the connection is not established yet error is coming
I had the same error it was due to client variable need time because it's async.
useEffect(() => {
if (client?.connect === true) return;
const socket = new SockJS("localhost:8080/ws");
messages;
if (client === null || client?.connected) setClient(Stomp.over(socket));
}, []);
useEffect(() => {
if (client !== null) {
client.connect({}, () => {
client.subscribe("/topic/messages", (message) => {
const receivedMessage = JSON.parse(message.body);
console.log(messages);
setMessages((messages) => [...messages, receivedMessage]);
});
});
setStompClient(client);
return () => {
client.disconnect();
};
}
}, [client]);
my sockJs error global
why ??
I'm getting the same, why? I do not get the solution :c
@@emersonperalesvillanueva8568 Are you guys using vite?
Can you do it for private message?
sure
@@itgift-ht1ro are you gonna make a video of it or you will just update the repository on GitHub?