Browse Source

无JIRA任务 WebSocket支持将用户名和token放在Header里

release/10.0
Cloud.Liu 4 years ago
parent
commit
63007db3d5
  1. 4
      fine-socketio/src/main/java/com/fr/third/socketio/handler/EncoderHandler.java

4
fine-socketio/src/main/java/com/fr/third/socketio/handler/EncoderHandler.java

@ -186,6 +186,10 @@ public class EncoderHandler extends ChannelOutboundHandlerAdapter {
} }
private void addOriginHeaders(String origin, HttpResponse res) { private void addOriginHeaders(String origin, HttpResponse res) {
// 使WebSocket连接时可添加fine_username和fine_auth_token的Header
res.headers().add(HttpHeaderNames.ACCESS_CONTROL_ALLOW_HEADERS, "fine_username,fine_auth_token");
if (version != null) { if (version != null) {
res.headers().add(HttpHeaderNames.SERVER, version); res.headers().add(HttpHeaderNames.SERVER, version);
} }

Loading…
Cancel
Save