如何为Netty io配置子协议? [英] How can I configure subprotocol for Netty io?

查看:205
本文介绍了如何为Netty io配置子协议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Websockets与Play框架一起使用. 当我尝试将值设置为HTTP标头Sec-WebSocket-Protocol时,例如"ocpp1.6",然后出现以下异常:

I am using websockets with Play framework. When I try to set value to the HTTP header Sec-WebSocket-Protocol, e.g. "ocpp1.6" then I get the following exception:

[error] p.nettyException - Exception caught in Netty
org.jboss.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Requested subprotocol(s) not supported: ocpp1.6

我看到发生错误是因为org.jboss.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory中的构造函数的"subprotocols"参数为空.

I can see that the error occurs because the constructor's "subprotocols" parameter in org.jboss.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory is null.

因此,我该如何更改此值,并且它是导致错误的唯一原因吗?

Therefore how can I change this value and is it the only reason which causes the error?

谢谢, -路易斯

推荐答案

Play框架不支持子协议,这似乎是一个已知的错误,应该在2.2.1版中对其进行修复:

It seems it is a known bug that the Play framework did not support subprotocols, which should be fixed by version 2.2.1:

https://github.com/playframework/playframework/pull/1722

这篇关于如何为Netty io配置子协议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆