https://github.com/salmar/spring-websocket-chat
参考是上述项目 用的是高层封装的stomp over websokcet
项目框架springboot+springmvc+redis+springsecurity
@MessageMapping("/chat.private.{username}")
public void filterPrivateMessage(@Payload ChatMessage message, @DestinationVariable("username") String username, Principal principal) {
checkProfanityAndSanitize(message);
message.setUsername(principal.getName());
simpMessagingTemplate.convertAndSend("/user/" + username + "/exchange/amq.direct/chat.message", message);
}
这里发送给用户是怎么实现的?不使用任何权限框架应该如何实现?