The WebSocket protocol is one of the ways to make The application handle real-time messages.
implementation 'org.webjars:webjars-locator-core'
implementation 'org.webjars:sockjs-client:1.0.2'
implementation 'org.webjars:stomp-websocket:2.3.3'
implementation 'org.webjars:bootstrap:3.3.7'
implementation 'org.webjars:jquery:3.1.1-1'
The service will accept messages that contain a name in a STOMP message in JSON object and to model JSON file contact you need to create name property and a corresponding getName() method.
Implement a controller that will handle user requests. It will broadcast received message to all users subscribed to a given topic.
*Also annotated with @EnableWebSocketMessageBroker to enables WebSocket message handling, backed by a message broker.
With the server side the client can send and receive messages to the server side.
imports the SockJS and STOMP in HTML file will be used to communicate with our server through STOMP over websocket
This guide walks you through the process of creating a “Hello, world” application that sends messages back and forth between a browser and a server.