Issue
I have found that there are two ways to connect a Spring Boot backend with an Angular frontend,
- Spring: regular spring-websocket broker, with Stomp. Angular StompJS and SockJS
- Spring: netty-socketio which is a port of socketIO. Angular Socket.IO
For 1), The SockJS and StompJS are outdated and not maintained. Spring is up to date with full capabilities
For 2), Socket.IO is the most modern to use with Angular, Spring: the netty-socketio is just a port for java, it does not have all the possibilities of the regular reactor web library
All guides mention spring the regular way with broker and stomp, like Baeldung and all Angular guides are about SocketIO.
However, I have not found a way for them to mix ? Can it be done and I am missing something? What is the best and most modern way to make such a web app now?
Solution
Stomp (over Websocket) and Socket.IO are independent protocols. With both you can archive more or less the same thing (asynchronous communication from server to client - and vice versa), but they are not compatible.
The used technology overlaps: Socket.IO defaults to websocket communication, but falls back to http (long-)polling when websockets are not available (happening rarely on aggressive coorporate firewalls..). Stomp does not prescribe the communication layer, but regularly websockets are used.
Answered By - daniel-sc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.