我不能wss://在我用Play!Framework 2.2创建的简单WebSocket应用程序中使用.它回复了消息.端点是这样的
def indexWS2 = WebSocket.using[String] {
request => {
println("got connection to indexWS2")
var channel: Option[Concurrent.Channel[String]] = None
val outEnumerator: Enumerator[String] = Concurrent.unicast(c => channel = Some(c))
// Log events to the console
val myIteratee: Iteratee[String, Unit] = Iteratee.foreach[String] {gotString => {
println("received: " + gotString)
// send string back
channel.foreach(_.push("echoing back \"" + gotString + "\""))
}}
(myIteratee, outEnumerator)
}
}
Run Code Online (Sandbox Code Playgroud)
并且路线被描述为
GET /ws2 controllers.Application.indexWS2
Run Code Online (Sandbox Code Playgroud)
我从这样的JS客户端创建连接
myWebSocket = new WebSocket("ws://localhost:9000/ws2");
Run Code Online (Sandbox Code Playgroud)
一切正常.但是,如果我改变ws://成wss://以使用TLS,它失败,我得到以下Netty的例外:
[error] …Run Code Online (Sandbox Code Playgroud)