update 带类型的SSE和带action的消息支持
parent
6822f0a7a8
commit
9ee30e5de3
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.common.sse;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Data
|
||||
public class SseAction<T> {
|
||||
|
||||
private String action;
|
||||
private T data;
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.ruoyi.common.sse;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 带类型的SseEmitter
|
||||
* @param <T>
|
||||
*/
|
||||
public class SseEmitter<T> extends org.springframework.web.servlet.mvc.method.annotation.SseEmitter {
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
@Getter
|
||||
private T type;
|
||||
|
||||
public SseEmitter(long timeout, T type) {
|
||||
super(timeout);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public SseEmitter(T id) {
|
||||
this(Long.MAX_VALUE, id);
|
||||
}
|
||||
|
||||
public SseEmitter() {
|
||||
this(Long.MAX_VALUE, null);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue