1
這裏是我的代碼,我得到了更多或更少this page:實現WebSocket但沒有找到回調?
public static WebSocket<String> testwebsocket() {
return new WebSocket<String>() {
//Called when the Websocket Handshake is done
public void onReady(WebSocket.In<String> in, WebSocket.Out<String> out) {
//For each event received on the socket
in.onMessage(new Callback<String>() {
public void invoke(String event) {
//Log events to the console
println(event);
}
});
}
};
}
當我跑,我得到它說一個錯誤「編譯錯誤:無法找到符號」,它指的是回調。我想我需要包括一些東西,但我嘗試了包括一堆庫,我不知道我錯過了什麼。文檔頁面上沒有關於此的信息。我正在使用Play Framework 2.0.4 Java版本。請幫我弄清楚爲什麼找不到Callback符號!