1

I have a function module that sends notifications to users and there are two types of users, 1.one is an ordinary account, each account can only be online once at the same time

2.the other is an ip user, when an ip user logs in, it determines whether the user's ip is Within the scope of the ip user table, and the username is the real-time ip of the obtained user as the username.

3.When I use simpMessagingTemplate.convertAndSendToUser(String user, String destination, Object payload)) to send a notification to a specified user, for ordinary users, I can directly pass the username, and for ip users, only id without username, For the username of the ip user, the real-time ip obtained when the ip user logs in is used as the username

4.The problem now is that when I want to send a notification to the ip user, I only have the id of the ip user and not the user name of the ip user. I want to call simpMessagingTemplate.convertAndSendToUser(String user, String destination, Object payload)) to send to the specified user and replace the user name with id. Is there any way to achieve this?

1

1 Answer 1

1

1.I solved the problem using this method. customize mine HandshakeHandler

2.customize mine Principal customize mine Principal

  1. setHandshakeHandler in StompEndpointRegistry setHandshakeHandler in StompEndpointRegistry
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.