Play Framework web server server does not process ping frames from netty client

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 =>
   // connection attempts are also indicated if client sends 'PingWebSocketFrame'
   Logger.info("Someone just connected!?")

   val (out, channel) = Concurrent.broadcast[Array[Byte]]

   // Messages of netty type 'PingWebSocketFrame' never enter here
   val in = Iteratee.foreach[Array[Byte]] { msg =>
      // the following line is printed if netty 'BinaryWebSocketFrame' was sent BUT
      //                         never if netty 'PingWebSocketFrame'   was sent, why?
      println("Some Binary data arrived, being of length " + msg.length + " [bytes]")
   }
(in, out)
}
+4
source share
1 answer

Playframework does not support pingframe. He simply ignored it. Now this is fixed in master

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

+2
source

All Articles