# netty

返回:服务

# 错误集锦

  • Max frame length of 65536 has been exceeded

若不设置,那么如源码中有默认值为:65536(数据帧最大长度,合理设置可避免大数据包攻击你的服务器)。

/**
    * Creates a new handshaker.
    *
    * @param webSocketURL
    *            URL for web socket communications. e.g "ws://myhost.com/mypath".
    *            Subsequent web socket frames will be sent to this URL.
    * @param version
    *            Version of web socket specification to use to connect to the server
    * @param subprotocol
    *            Sub protocol request sent to the server. Null if no sub-protocol support is required.
    * @param allowExtensions
    *            Allow extensions to be used in the reserved bits of the web socket frame
    * @param customHeaders
    *            Custom HTTP headers to send during the handshake
    * @param maxFramePayloadLength
    *            Maximum allowable frame payload length. Setting this value to your application's
    *            requirement may reduce denial of service attacks using long data frames.
    */
public static WebSocketClientHandshaker newHandshaker(
        URI webSocketURL, WebSocketVersion version, String subprotocol,
        boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) {
    return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders,
                            maxFramePayloadLength, true, false);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24