1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.anyflow.lannister.http;
18
19 import java.util.List;
20
21 import io.netty.channel.ChannelHandlerContext;
22 import io.netty.handler.codec.MessageToMessageDecoder;
23 import io.netty.handler.codec.http.websocketx.WebSocketFrame;
24
25 public abstract class WebsocketFrameHandler extends MessageToMessageDecoder<WebSocketFrame> {
26 public static final List<String> DEFAULT_SUBPROTOCOLS = null;
27 public static final boolean ALLOW_EXTENSIONS = false;
28 public static final int MAX_FRAME_SIZE = 65536;
29
30 public abstract String subprotocols();
31
32 public abstract String websocketPath();
33
34 public abstract boolean allowExtensions();
35
36 public abstract int maxFrameSize();
37
38 public abstract void websocketFrameReceived(ChannelHandlerContext ctx, WebSocketFrame wsframe);
39
40 @Override
41 protected void decode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception {
42 websocketFrameReceived(ctx, msg);
43 }
44 }