Dealing with Websockets, I took netty's client and a server (code pasted below) which I built with Play Framework (2.2.1) using Scala (2.10.2). The server does not react on client's Ping messages. Neither takes the Iteratee notice of any incoming Ping message, nor does the Framework itself respond to Ping messages.
However, my application processes incoming binary frames. This looks strange to me because in Netty's code, Binary frames are pretty similar to Ping frames. The only difference which I am aware of is the OpCode, i.e. 0x9 for Ping and 0x2 for Binay.
Can anyone explain this behaviour and give me a hint how to deal with Websocket Ping/Pong frames in Play Framework?
def connect = WebSocket.using[Array[Byte]] { request =>
// connection attempts are also indicated if client sends 'PingWebSocketFrame'
Logger.info("Someone just connected!?")
val (out, channel) = Concurrent.broadcast[Array[Byte]]
// Messages of netty's type 'PingWebSocketFrame' never enter here
val in = Iteratee.foreach[Array[Byte]] { msg =>
// the following line is printed if netty's 'BinaryWebSocketFrame' was sent BUT
// never if netty's 'PingWebSocketFrame' was sent, why?
println("Some Binary data arrived, being of length " + msg.length + " [bytes]")
}
(in, out)
}