您确定要退出登录吗?
修改密码
tio-websocket-server是基于t-io实现的websocket服务器,自带t-io提供的各项API以及一流的性能和稳定性
https://gitee.com/tywo45/tio-websocket-showcase
public WsRequest decode(ByteBuffer buffer, int limit, int position, int readableLength,
ChannelContext channelContext) throws TioDecodeException {
WsSessionContext wsSessionContext = (WsSessionContext) channelContext.get();
// int initPosition = buffer.position();
if (!wsSessionContext.isHandshaked()) {// 尚未握手
HttpRequest request = HttpRequestDecoder.decode(buffer, limit, position, readableLength, channelContext,
wsServerConfig);
if (request == null) {
return null;
}
HttpResponse httpResponse = updateWebSocketProtocol(request, channelContext);
if (httpResponse == null) {
throw new TioDecodeException("http协议升级到websocket协议失败");
}
wsSessionContext.setHandshakeRequest(request);
wsSessionContext.setHandshakeResponse(httpResponse);
WsRequest wsRequestPacket = new WsRequest();
// wsRequestPacket.setHeaders(httpResponse.getHeaders());
// wsRequestPacket.setBody(httpResponse.getBody());
wsRequestPacket.setHandShake(true);
return wsRequestPacket;
}
确定要删除该条评论吗?
重置 发表评论