I have a question.
I got a Spring server and a Client (Angularjs). In my client i got a Rickshaw realtime chart.
When my server get some objects from a 3rd party software, i need it to send it to the client. This happens each 28th seconds.
I tried with websocket, and with SSE and i cannot get it to work. I need someone to point me at a direction, since im lost atm.
Example.
Our server got a class called Animal. Then a 3rd party software is sending a new object of Animal (E.g dog-cat) each 28th second. When the server retrieves this object it, insert it in the DB and send it to the client. The last part is what i can't make work.
Websocket tryout:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config){
config.enableSimpleBroker("/MashData/data");
config.setApplicationDestinationPrefixes("/app");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry){
registry.addEndpoint("/mashData").setAllowedOrigins("*").withSockJS();
}
}
And in my controller
@MessageMapping("/mashData")
@SendTo("/MashData/data")
@Async
public MashData insertData(@PathVariable Long id, @RequestBody MashData INCmashData){
*Data created here*
return insertData
}