org.atmosphere.samples.pubsub
Class TypedChannel
java.lang.Object
org.atmosphere.samples.pubsub.TypedChannel
public class TypedChannel
- extends Object
Simple Resource acting like a channel of communication.
- Author:
- Jeanfrancois Arcand
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TypedChannel
public TypedChannel()
handshake
@Subscribe(value="channel")
public String handshake()
- Subscribe to "channel" distribution. With comet, the http connection will be suspended. With websocket,
the handshake will gets executed.
- Returns:
- null - no message is send back to browser yet.
onMessage
@Publish(value="channel")
public String onMessage(String message)
- Broadcast messages to the "channel" distribution. This method gets invoked when a WebSocket message arrive and distributed to
all websocket connection that has invoked the handshake method. Note that comet application will works as well
when sending POST.
- Parameters:
message - the message to distribute
- Returns:
- the message that will be send to the "channel" distribution.
Copyright © 2011. All Rights Reserved.