Skip to content

Using the WebSocketHandlerService Annotation

Jeanfrancois Arcand edited this page Sep 9, 2013 · 2 revisions

The WebSocketHandlerService can be used to configure an implementation of WebSocketHandlerService. As simple as this

@WebSocketHandlerService

The annotation's attributes available are

  • path: The path to the resource. The default is "/" so if your have mapped the MeteorServlet to '/*', all request will be delivered to your annotated class. You can also customize the path. The path value will be used to associate the AtmosphereResource with a Broadcaster, and the Broadcater's getID() will be the path value.
  • listeners: Add one or several WebSocketServiceEventListener. Usefull if your application needs to execute some actions based on the AtmosphereResource's life cycle.
  • broadcaster: The Broadcaster to use for every request. The default is the DefaultBroadcaster
  • interceptors: The list of AtmosphereInterceptor. It is strongly recommended to install one or all of the following interceptor to simplify your application's code: TrackMessageSizeInterceptor, HeartbeatInterceptor,
  • atmosphereConfig: Configure some ApplicationConfig properties. Those properties can be used to configure the Atmosphere's runtime. Default is empty.
  • broadcasterCache: Install a BroadcasterCache to repent loosing messages when a network outage happens.. Default is UUIDBroadcasterCache
  • broadcastFilters: Install BroadcastFilter for manipulating messages before they get delivered to the client. Default is empty.

Class Scope Annotations available

@Singleton

The Singleton annotation can be used to force Atmosphere to create a single, thread safe instance of a WebSocketHandlerService's annotated classes. For example, if your application set the @WebSocketHandlerService's path attribute with using path templates {something}, by default a new instance of the annotated classes will be created. When annotated with Singleton, a single class will be created.

Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics

API

Known WebServer Issues

References

External Documentations

githalytics.com alpha

Clone this wiki locally