You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
package com.platform.websocket;
|
|
|
|
import org.springframework.web.socket.CloseStatus;
|
|
import org.springframework.web.socket.TextMessage;
|
|
import org.springframework.web.socket.WebSocketHandler;
|
|
import org.springframework.web.socket.WebSocketMessage;
|
|
import org.springframework.web.socket.WebSocketSession;
|
|
|
|
public class SystemWebSocketHandler implements WebSocketHandler {
|
|
|
|
@Override
|
|
public void afterConnectionClosed(WebSocketSession arg0, CloseStatus arg1)
|
|
throws Exception {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void afterConnectionEstablished(WebSocketSession arg0)
|
|
throws Exception {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void handleMessage(WebSocketSession arg0, WebSocketMessage<?> arg1)
|
|
throws Exception {
|
|
// TODO Auto-generated method stub
|
|
TextMessage returnMessage = new TextMessage("received at server");
|
|
sendMessageToUsers(returnMessage);
|
|
System.out.println("接到请求");
|
|
}
|
|
|
|
@Override
|
|
public void handleTransportError(WebSocketSession arg0, Throwable arg1)
|
|
throws Exception {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public boolean supportsPartialMessages() {
|
|
// TODO Auto-generated method stub
|
|
return false;
|
|
}
|
|
|
|
public void sendMessageToUsers(TextMessage message) {
|
|
|
|
}
|
|
|
|
}
|