module hunt.imf.protocol.websocket.WsCodec; import hunt.net.codec.Codec; import hunt.http.codec.CommonDecoder; import hunt.http.codec.CommonEncoder; import hunt.net.codec.Encoder; import hunt.net.codec.Decoder; import hunt.http.server.Http1ServerDecoder; import hunt.http.server.Http2ServerDecoder; import hunt.http.codec.websocket.decode.WebSocketDecoder; class WsCodec : Codec { private CommonEncoder encoder = null; private CommonDecoder decoder = null; this() { encoder = new CommonEncoder(); Http1ServerDecoder httpServerDecoder = new Http1ServerDecoder( new WebSocketDecoder(), new Http2ServerDecoder()); decoder = new CommonDecoder(httpServerDecoder); } Encoder getEncoder() { return encoder; } Decoder getDecoder() { return decoder; } }