사용자 도구

사이트 도구


springframework:httpstream

문서의 이전 판입니다!


Spring HTTP Streaming

Reverse Proxy(nginx) 설정

@RequestMapping("/sseExamples")
public SseEmitter getRealTimeJudgeResultAction(HttpServletResponse response) throws IOException {
    // ....
	response.addHeader("X-Accel-Buffering", "no");
	SseEmitter sseEmitter = new SseEmitter();
    // ....
    sseEmitter.send("Established");
	return sseEmitter;
}
  • 아니면 nginx 의 SSE 관련 url 프록시에 대해서만 proxy_buffering off; 설정.
location /path/to/sse {
  proxy_pass http://chat_dev_upstream;
  proxy_buffering off;
  proxy_cache off;
  proxy_set_header Host $host;
  proxy_set_header Connection '';
  proxy_http_version 1.1;
  chunked_transfer_encoding off;
}

참고

springframework/httpstream.1641273663.txt.gz · 마지막으로 수정됨: 2022/01/04 14:21 저자 kwon37xi