Skip to content

Listen and Response a Request

Ta Van Dung edited this page Jun 15, 2016 · 1 revision
import com.tvd12.ezyfox.core.annotation.ClientRequestListener;
import com.tvd12.ezyfox.core.annotation.ClientResponseHandler;
import com.tvd12.ezyfox.core.annotation.RequestParam;
import com.tvd12.ezyfox.core.annotation.ResponseParam;
import com.tvd12.ezyfox.core.content.AppContext;

import lombok.Data;

@Data
@ClientResponseHandler // auto response to client with command = "sum"
@ClientRequestListener(command = "sum")
public class SumRequestListener {
    
    @RequestParam private int a;
    @RequestParam private int b;
    @ResponseParam private int total;
    
    public void execute(AppContext context, GameUser user) {
        total = a + b;
    }
    
}

Hello World

Clone this wiki locally