org.atmosphere.wasync
Interface Function<T>
- Type Parameters:
T -
public interface Function<T>
A function is asynchronously invoked when a response is received, complete or not.
This library supports predefined life cycle's events (@link #MESSAGE} that can be used. For example, a Function
can be defined for handling IOException:
class Function<IOException>() {
public void on(IOEXception ex) {
}
}
This function can be registered using the Socket.on(Function) as
socket.on(new Function<IOEXception>() {
....
}
This is the equivalent of doing
socket.on(MESSAGE.error, new Function<IOEXception>() {
....
}
Anonymous functions call also be invoked if a Decoder match its type
socket.decoder(new Decoder<String, POJO>(){
@Override
public POJO decode(String message) {
return new POJO(message);
}
}
.on(new Function<POJO>() {
....
}
- Author:
- Jeanfrancois Arcand
|
Method Summary |
void |
on(T t)
A function that will be invoked when a |
on
void on(T t)
- A function that will be invoked when a
- Parameters:
t -
Copyright © 2013. All Rights Reserved.