Comet 기능 구현

S/Servlet 2014. 11. 9. 00:11

Reverse Ajax, Ajax Push, Two-Way-Web, HTTP server PUSH 등등으로 불리던 말이 이제 Comet 이라는 용어로 통일되어 가는 거 같다.

Comet 이란 웹 클라이언트(보통 웹 브라우저)의 명시적인 요청이 없어도 서버에서 클라이언트로 데이타를 밀어넣는(Push) 방식으로 동작하는 웹 프로그래밍 모델을 일컫는 말이다.


1. Polling 


2. Long Polling


3. Streaming


이중 Long Polling 과 Streaming 을 Comet 기능으로 주로 사용함.


Spring Framework 에선 WebSocket을 이용한 Comet 기능 구현이 있다. 

페이스북과 같이 댓글이 실시간으로 바로 나오기 위해서 사용하게 된다.


다만 주의할 점은 톰캣 8 이상에서 테스팅이 원활하게 진행이 된다.

만일 톰캣 버젼이 낮을 경우에는 

 org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.socket.server.support.DefaultHandshakeHandler]: Constructor threw exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found

라는 에러가 뜨게 될 것이다. 이것저것 시도해보았지만 톰캣 서버 버젼을 높이는 경우 밖에 없는 듯 하다.





설정

트랙백

댓글