27 lines
877 B
Java
27 lines
877 B
Java
|
|
package com.example.utils.SockJs;
|
||
|
|
|
||
|
|
|
||
|
|
import org.springframework.messaging.simp.stomp.StompHeaders;
|
||
|
|
import org.springframework.messaging.simp.stomp.StompSession;
|
||
|
|
import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter;
|
||
|
|
|
||
|
|
import java.util.concurrent.ExecutionException;
|
||
|
|
|
||
|
|
public class TEST009 {
|
||
|
|
public static void main(String[] args) throws ExecutionException, InterruptedException {
|
||
|
|
SockJsTool tool=new SockJsTool("http://localhost:8080/system/websocket");
|
||
|
|
|
||
|
|
StompSession session=tool.getSession();
|
||
|
|
session.subscribe("/user/topic/subscribePrint5",new StompSessionHandlerAdapter(){
|
||
|
|
@Override
|
||
|
|
public void handleFrame(StompHeaders headers, Object payload) {
|
||
|
|
System.out.println(payload);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
session.send("/app/downloadLocal","2");
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|