Where “user” comes from in convertAndSendToUser works in SockJS+Spring Websocket?

前端 未结 2 1208
遥遥无期
遥遥无期 2020-12-12 17:47

I would like to understand how convertAndSendToUser works in Spring SockJS+Websocket framework.

In client, we would connect as

stompClient.connect(lo         


        
2条回答
  •  遥遥无期
    2020-12-12 18:01

    I did not do any specific configuration and I can just do this:

    @MessageMapping('/hello')
    protected void hello(Principal principal, Map message) {
        String username = principal.getName();
    }
    

提交回复
热议问题