mirror of
https://gitee.com/xiaonuobase/snowy.git
synced 2026-03-22 02:37:16 +08:00
【重构】站内信消息SSE彻底更改为ws方案
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [https://www.xiaonuo.vip]
|
||||
*
|
||||
* Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
* 2.请不要删除和修改Snowy源码头部的版权声明。
|
||||
* 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
|
||||
* 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
|
||||
* 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
|
||||
* 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||
*/
|
||||
package vip.xiaonuo.dev.api;
|
||||
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
import vip.xiaonuo.common.sse.CommonSseParam;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* SSE API接口
|
||||
*
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public interface DevSseApi {
|
||||
|
||||
/**
|
||||
* 创建SSE连接
|
||||
*
|
||||
* @param clientId 客户端id,不传则自动生成
|
||||
* @param setHeartBeat 是否设置心跳定时任务,默认为false(true:设置 false:不设置)
|
||||
* @param defaultHeartbeat 是否使用默认心跳任务
|
||||
* @param consumer 自定义心跳任务,需要自定义实现Consumer接口中的accept方法(setHeartBeat必须为true,defaultHeartbeat为false才有意义)
|
||||
* @return 初次建立连接会推送客户端id,状态码为0
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public SseEmitter createSseConnect(String clientId, Boolean setHeartBeat, Boolean defaultHeartbeat, Consumer<CommonSseParam> consumer);
|
||||
|
||||
/**
|
||||
* 关闭连接
|
||||
*
|
||||
* @param clientId 客户端id
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public void closeSseConnect(String clientId);
|
||||
|
||||
/**
|
||||
* 推送消息到所有客户端
|
||||
*
|
||||
* @param msg 推送消息
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public void sendMessageToAllClient(String msg);
|
||||
|
||||
/**
|
||||
* 根据clientId发送消息给某一客户端
|
||||
*
|
||||
* @param clientId 客户端id
|
||||
* @param msg 推送消息
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public void sendMessageToOneClient(String clientId, String msg);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user