-
-
Notifications
You must be signed in to change notification settings - Fork 751
Understanding JavaScript functions
Functions definitions see for more information
When using the jQuery.atmosphere.js or atmosphere.js Javascript client, you have several functions you can set in order to get notified when events occurs:
-
onOpen:
- onOpen will be called for all transports when the connection is fully established.
-
onClose: The onClose is called when:
- an error occurs.
- when the server or a proxy closes the connection.
- when an expected exception occurs.
- when the specified transport is not supported or fail to connect.
-
onMessage: Everytime a new message is received
-
onError: The onError is called when:
- the request.maxReconnectOnClose re-connect try has failed
- an unexpected error occured.
-
onTransportFailure: if the specified transport fails to connect, this function will be called before the reconnect, with the fallbackTransport.
-
onClientTimeout: if the request.timeout expires, this function will be called, allowing an application to reconnect if needed.
-
onReconnect:
- Every time an error happens and a reconnect needs to happens. This works for all transport, e.g for long-polling, onReconnect will only be called if an error happens and never before reconnecting.
-
onReopen: this function is called every time a re-connection successfully reconnected.
-
onMessagePublished: Except for websockets, the onMessagePublished will be invoked when a POST is made and the server side is sending a response using the 'polling' connection.
onOpen -> onMessage -> onClose // Normal
onTransportFailure -> onOpen -> onMessage -> onClose // transport not supported
onOpen -> onMessage -> [connection closed] -> onReconnect -> onClose -> onError // maxReconnectOnClose
onOpen -> onMessage -> [connection closed] -> onReconnect -> onMessage
onOpen -> [request.timeout expires] -> onClientTimeout
- Understanding Atmosphere
- Understanding @ManagedService
- Using javax.inject.Inject and javax.inject.PostConstruct annotation
- Understanding Atmosphere's Annotation
- Understanding AtmosphereResource
- Understanding AtmosphereHandler
- Understanding WebSocketHandler
- Understanding Broadcaster
- Understanding BroadcasterCache
- Understanding Meteor
- Understanding BroadcastFilter
- Understanding Atmosphere's Events Listeners
- Understanding AtmosphereInterceptor
- Configuring Atmosphere for Performance
- Understanding JavaScript functions
- Understanding AtmosphereResourceSession
- Improving Performance by using the PoolableBroadcasterFactory
- Using Atmosphere Jersey API
- Using Meteor API
- Using AtmosphereHandler API
- Using Socket.IO
- Using GWT
- Writing HTML5 Server-Sent Events
- Using STOMP protocol
- Streaming WebSocket messages
- Configuring Atmosphere's Classes Creation and Injection
- Using AtmosphereInterceptor to customize Atmosphere Framework
- Writing WebSocket sub protocol
- Configuring Atmosphere for the Cloud
- Injecting Atmosphere's Components in Jersey
- Sharing connection between Browser's windows and tabs
- Understanding AtmosphereResourceSession
- Manage installed services
- Server Side: javadoc API
- Server Side: atmosphere.xml and web.xml configuration
- Client Side: atmosphere.js API