Search in sources :

Example 1 with AtmosphereServlet

use of org.atmosphere.cpr.AtmosphereServlet in project spring-boot by spring-projects.

the class SampleAtmosphereApplication method atmosphereServlet.

@Bean
public ServletRegistrationBean<AtmosphereServlet> atmosphereServlet() {
    // Dispatcher servlet is mapped to '/home' to allow the AtmosphereServlet
    // to be mapped to '/chat'
    ServletRegistrationBean<AtmosphereServlet> registration = new ServletRegistrationBean<>(new AtmosphereServlet(), "/chat/*");
    registration.addInitParameter("org.atmosphere.cpr.packages", "sample");
    registration.addInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor" + ".clientHeartbeatFrequencyInSeconds", "10");
    registration.setLoadOnStartup(0);
    // Need to occur before the EmbeddedAtmosphereInitializer
    registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return registration;
}
Also used : AtmosphereServlet(org.atmosphere.cpr.AtmosphereServlet) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

AtmosphereServlet (org.atmosphere.cpr.AtmosphereServlet)1 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)1 Bean (org.springframework.context.annotation.Bean)1