public class SseWebController<ACCESS_USER extends AccessUser & AccessToken> extends Object
1. 如果用nginx代理, 要加下面的配置 # 长连接配置 proxy_buffering off; proxy_read_timeout 7200s; proxy_pass http://xx.xx.xx.xx:xxx; proxy_http_version 1.1; #nginx默认是http1.0, 改为1.1 支持长连接, 和后端保持长连接,复用,防止出现文件句柄打开数量过多的错误 proxy_set_header Connection ""; # 去掉Connection的close字段
| 限定符和类型 | 类和说明 |
|---|---|
static class |
SseWebController.ResponseWrap<T> |
| 构造器和说明 |
|---|
SseWebController() |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
connect(Map query,
Map body,
Long keepaliveTime,
javax.servlet.http.HttpServletRequest request)
创建连接
|
org.springframework.http.ResponseEntity |
disconnect(Long connectionId)
关闭连接
|
org.springframework.http.ResponseEntity |
disconnect0(Long connectionId)
关闭连接
|
boolean |
isBlank(CharSequence str) |
org.springframework.http.ResponseEntity |
send(Map query,
Map body)
推送给所有人
|
org.springframework.http.ResponseEntity |
sendOne(Map query,
Map body,
Object userId)
发送给单个人
|
void |
setLocalConnectionService(LocalConnectionService localConnectionService) |
void |
setLocalConnectionServiceMap(Map<String,LocalConnectionService> localConnectionServiceMap) |
public void setLocalConnectionService(LocalConnectionService localConnectionService)
@Autowired(required=false) public void setLocalConnectionServiceMap(Map<String,LocalConnectionService> localConnectionServiceMap)
@RequestMapping(value="/connect") public Object connect(@RequestParam Map query, @RequestBody(required=false) Map body, Long keepaliveTime, javax.servlet.http.HttpServletRequest request)
@RequestMapping(value="/send")
public org.springframework.http.ResponseEntity send(@RequestParam
Map query,
@RequestBody(required=false)
Map body)
@RequestMapping(value="/send/{userId}")
public org.springframework.http.ResponseEntity sendOne(@RequestParam
Map query,
@RequestBody(required=false)
Map body,
@PathVariable
Object userId)
userId - 用户ID@RequestMapping(value="/disconnect/{connectionId}")
public org.springframework.http.ResponseEntity disconnect(@PathVariable
Long connectionId)
@RequestMapping(value="/disconnect") public org.springframework.http.ResponseEntity disconnect0(Long connectionId)
public boolean isBlank(CharSequence str)
Copyright © 2022. All rights reserved.