views:

40

answers:

0

It appears that the ActiveMQ FuseSource Stomp PHP client can't handle messages larger than 1024 bytes. The code is as follows in Stomp.php:

   $rb = 1024;
   $data = '';
   $end = false;

   do {
       $read = fread($this->_socket, $rb);
       if ($read === false) {
           $this->_reconnect();
           return $this->readFrame();
       }
       $data .= $read;
       if (strpos($data, "\x00") !== false) {
           $end = true;
           $data = rtrim($data, "\n");
       }
       $len = strlen($data);
   } while ($len < 2 || $end == false);

If I set $rb to a larger value e.g. 1048576, it consumes the whole message and works as expected. What appears to be happening is that the first 1024 bytes are read, the loop exit condition is not met and then the client hangs on the $read = fread($this->_socket, $rb); line.

I'm using: