E
E
EgorSvinarev2022-02-25 20:31:05
Java
EgorSvinarev, 2022-02-25 20:31:05

How to send message to sender via WebSocket?

Hello. I need to issue a response to a specific sender on an incoming message to a web socket. There is the following

the code
@MessageMapping("/terminal")
public void transmitData(@Payload StdInDTO data, Principal user, @Header("simpSessionId") String sessionId) throws Exception{
  StdOutDTO stdOutDto = StdOutConverter.toDTO(terminalService.transmitData(StdInConverter.fromDTO(data), sessionId));
  
  simpMessagingTemplate.convertAndSendToUser("Какой-то пользователь", "/user/queue/", stdOutDto);;
}

How can I identify the recipient of a message so that the message is sent to the sender of the original message?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question