[英]jetty 9 websockets onFrame event
On older versions of jetty (7 and 8) we had an onFrame ( http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/websocket/WebSocket.OnFrame.html ) event for websockets. 在旧版本的码头(7和8)上,我们为websockets设置了onFrame( http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/websocket/WebSocket.OnFrame.html )事件。 Is there an equivalent in version 9? 版本9是否具有等效功能? They have WebSocketListener ( http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/websocket/api/WebSocketListener.html ) interface but there is no onFrame method defined. 它们具有WebSocketListener( http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/websocket/api/WebSocketListener.html )接口,但未定义onFrame方法。
Thanks 谢谢
You will need to use annotated websockets to get access to the websocket frames. 您将需要使用带注释的websocket来访问websocket框架。
Javadoc: 的Javadoc:
@OnWebSocketFrame
Frame
interface Frame
界面 Example Socket: 套接字示例:
package examples;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.api.extensions.Frame;
@WebSocket
public class AnnotatedFramesSocket
{
@OnWebSocketClose
public void onClose(int statusCode, String reason)
{
System.out.printf("onClose(%d, %s)%n",statusCode,reason);
}
@OnWebSocketConnect
public void onConnect(Session sess)
{
System.out.printf("onConnect(%s)%n",sess);
}
@OnWebSocketFrame
public void onFrame(Frame frame)
{
System.out.printf("onFrame(%s)%n",frame);
}
}
Now, I need to ask, why do you need access to the post-extension-processed frames? 现在,我要问,为什么需要访问扩展后处理的帧?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.