|
@@ -7,19 +7,18 @@ import javax.websocket.OnError;
|
|
|
import javax.websocket.OnMessage;
|
|
|
import javax.websocket.OnOpen;
|
|
|
import javax.websocket.Session;
|
|
|
-import javax.websocket.server.PathParam;
|
|
|
import javax.websocket.server.ServerEndpoint;
|
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.util.DateUtil;
|
|
|
|
|
|
-@ServerEndpoint("{mapping}")
|
|
|
+@ServerEndpoint("/ws")
|
|
|
@Component
|
|
|
public class WebSocketServerEndpoint {
|
|
|
|
|
|
@OnOpen
|
|
|
- public void onOpen(Session session, @PathParam("mapping") String mapping) {
|
|
|
+ public void onOpen(Session session) {
|
|
|
System.out.println("onOpen; session=" + session);
|
|
|
try {
|
|
|
session.getBasicRemote().sendText(DateUtil.chinaNow() + "| fuck");
|
|
@@ -29,12 +28,12 @@ public class WebSocketServerEndpoint {
|
|
|
}
|
|
|
|
|
|
@OnClose
|
|
|
- public void onClose(Session session, @PathParam("mapping") String mapping) {
|
|
|
+ public void onClose(Session session) {
|
|
|
System.out.println("onClose; session=" + session);
|
|
|
}
|
|
|
|
|
|
@OnMessage
|
|
|
- public void onMessage(Session session, @PathParam("mapping") String mapping, String message) {
|
|
|
+ public void onMessage(Session session, String message) {
|
|
|
System.out.println("onMessage; session=" + session);
|
|
|
System.out.println("onMessage; message=" + message);
|
|
|
try {
|
|
@@ -45,7 +44,7 @@ public class WebSocketServerEndpoint {
|
|
|
}
|
|
|
|
|
|
@OnError
|
|
|
- public void onError(Session session, @PathParam("mapping") String mapping, Throwable t) {
|
|
|
+ public void onError(Session session, Throwable t) {
|
|
|
System.out.println("onError; session=" + session);
|
|
|
t.printStackTrace();
|
|
|
}
|