一对一聊天开发完成
This commit is contained in:
@@ -69,9 +69,12 @@ public class WebSocketServer {
|
||||
*/
|
||||
@OnMessage
|
||||
public void onMessage(String message) throws IOException {
|
||||
System.out.println("-------------------------------------------------------------------");
|
||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||
String userId = jsonObject.getString("userId");
|
||||
String type = jsonObject.getString("type");
|
||||
System.out.println(type);
|
||||
System.out.println(message);
|
||||
if (type.equals(MessageType.CHAT.getType())) {
|
||||
log.debug("聊天消息推送");
|
||||
sendToUser(userId, JSONObject.toJSONString(jsonObject));
|
||||
|
||||
Reference in New Issue
Block a user