Turning to Websockets, I took the netty client and the server (the code inserted below), which I created using the Play Framework (2.2.1) using Scala (2.10.2). The server does not respond to Ping client messages. It does not receive Iteratee notification of any incoming Ping message, nor does the Framework itself respond to Ping messages.
However, my application handles incoming binary frames. This seems strange to me, because in Netty code , Binary frames are very similar to Ping frames. The only difference I know about is OpCode, i.e. 0x9 for Ping and 0x2 for Binay.
Can someone explain this behavior and give me a hint how to deal with the Ping / Pong Websocket framework in the Play Framework?
def connect = WebSocket.using[Array[Byte]] { request =>
Logger.info("Someone just connected!?")
val (out, channel) = Concurrent.broadcast[Array[Byte]]
val in = Iteratee.foreach[Array[Byte]] { msg =>
println("Some Binary data arrived, being of length " + msg.length + " [bytes]")
}
(in, out)
}
source
share