org.atmosphere.samples.chat
Class ChatRoom

java.lang.Object
  extended by org.atmosphere.samples.chat.ChatRoom

@ManagedService(path="/chat/{room: [a-zA-Z][a-zA-Z_0-9]*}")
public class ChatRoom
extends Object

Simple annotated class that demonstrate the power of Atmosphere. This class supports all transports, support message length guarantee, heart beat, message cache thanks to the ManagedService.


Constructor Summary
ChatRoom()
           
 
Method Summary
 void onDisconnect(org.atmosphere.cpr.AtmosphereResourceEvent event)
          Invoked when the client disconnect or when an unexpected closing of the underlying connection happens.
 ChatProtocol onMessage(ChatProtocol message)
          Simple annotated class that demonstrate how Encoder and {@link org.atmosphere.config.managed.Decoder can be used.
 void onPrivateMessage(UserMessage user)
           
 ChatProtocol onReady(org.atmosphere.cpr.AtmosphereResource r)
          Invoked when the connection as been fully established and suspended, e.g ready for receiving messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChatRoom

public ChatRoom()
Method Detail

onReady

public ChatProtocol onReady(org.atmosphere.cpr.AtmosphereResource r)
Invoked when the connection as been fully established and suspended, e.g ready for receiving messages.

Parameters:
r -

onDisconnect

public void onDisconnect(org.atmosphere.cpr.AtmosphereResourceEvent event)
Invoked when the client disconnect or when an unexpected closing of the underlying connection happens.

Parameters:
event -

onMessage

public ChatProtocol onMessage(ChatProtocol message)
                       throws IOException
Simple annotated class that demonstrate how Encoder and {@link org.atmosphere.config.managed.Decoder can be used.

Parameters:
message - an instance of ChatProtocol
Returns:
Throws:
IOException

onPrivateMessage

public void onPrivateMessage(UserMessage user)
                      throws IOException
Throws:
IOException


Copyright © 2014. All Rights Reserved.