사용자 도구

사이트 도구


springframework:httpstream

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
마지막 판 양쪽 다음 판
springframework:httpstream [2022/01/04 14:25]
kwon37xi [Reverse Proxy(nginx) 설정]
springframework:httpstream [2022/01/04 16:59]
kwon37xi [ServerSentEvent Reverse Proxy(nginx) 설정]
줄 3: 줄 3:
   * [[springframework:webflux|Spring WebFlux]] 사용시 더 깔끔하다.   * [[springframework:webflux|Spring WebFlux]] 사용시 더 깔끔하다.
  
-===== Reverse Proxy(nginx) 설정 =====+===== ServerSentEvent Reverse Proxy(nginx) 설정 =====
   * [[:nginx|Ngnix]] 같은 reverse proxy 사용시에 buffering 을 끄는 등의 별도 설정이 필요하다.   * [[:nginx|Ngnix]] 같은 reverse proxy 사용시에 buffering 을 끄는 등의 별도 설정이 필요하다.
  
줄 10: 줄 10:
   * [[https://github.com/wandenberg/nginx-push-stream-module|wandenberg/nginx-push-stream-module: A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.]]   * [[https://github.com/wandenberg/nginx-push-stream-module|wandenberg/nginx-push-stream-module: A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.]]
   * 서버측에서 ''X-Accel-Buffering: no'' 응답 헤더를 내려주면 SSE 커넥션만 버퍼링 방지.   * 서버측에서 ''X-Accel-Buffering: no'' 응답 헤더를 내려주면 SSE 커넥션만 버퍼링 방지.
 +  * [[https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/|nginx x-accel-* 헤더를 통한 응답 제어]]
 <code java> <code java>
 @RequestMapping("/sseExamples") @RequestMapping("/sseExamples")
줄 21: 줄 21:
     return sseEmitter;     return sseEmitter;
 } }
 +</code>
 +<code>
 +# 응답 결과를 보면 X-Accel-Buffering: no 헤더가 출력됨.
 +curl -D - http://....
 +HTTP/1.1 200
 +X-Accel-Buffering: no
 +Content-Type: text/event-stream
 +Transfer-Encoding: chunked
 +...
 </code> </code>
   * 아니면 nginx 의 SSE 관련 url 프록시에 대해서만 ''proxy_buffering off;'' 및 기타 설정.   * 아니면 nginx 의 SSE 관련 url 프록시에 대해서만 ''proxy_buffering off;'' 및 기타 설정.
-  * [[https://stackoverflow.com/questions/13672743/eventsource-server-sent-events-through-nginx|ruby - EventSource / Server-Sent Events through Nginx - Stack Overflow]]+  * [[https://stackoverflow.com/questions/13672743/eventsource-server-sent-events-through-nginx|ruby - EventSource / Server-Sent Events through Nginx - Stack Overflow]] - https://stackoverflow.com/a/13673298/1051402
  
 <code> <code>
줄 36: 줄 45:
 } }
 </code> </code>
 +  * [[https://medium.com/tokopedia-engineering/server-sent-events-26f75e3a5ed2|Server Sent Events. File Upload Progress API using Server… | by Somesh Singh | Tokopedia Engineering | Medium]] : 좀 더 잘 설명돼 있는 듯.
 ===== 참고 ===== ===== 참고 =====
   * [[https://supawer0728.github.io/2018/03/15/spring-http-stereamings/|Spring5에서 HTTP Streaming | 기록은 재산이다]]   * [[https://supawer0728.github.io/2018/03/15/spring-http-stereamings/|Spring5에서 HTTP Streaming | 기록은 재산이다]]
springframework/httpstream.txt · 마지막으로 수정됨: 2022/01/04 17:00 저자 kwon37xi