Giter VIP home page Giter VIP logo

stomp's People

Contributors

andreybolonin avatar carusogabriel avatar cboden avatar clue avatar dominikb avatar e3betht avatar easen avatar fabpot avatar igorw avatar jakubkulhan avatar jsor avatar romainneutron avatar the-eater avatar wyrihaximus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stomp's Issues

Connect asynchronously

Currently the connect call itself is blocking.

We should call stream_socket_client with the STREAM_CLIENT_ASYNC_CONNECT flag. But that means we cannot tell connection failure at connect time.

We can only detect connection failure if we have reactphp/reactphp#113. So that needs to be fixed first.

Didn't work with rabbitmq

RabbitMQ 3.5.4
Debian 3.2.68-1+deb7u1 i686 GNU/Linux
PHP 5.5.30-1~dotdeb+7.1

/react/stomp/examples$ php basic.php rabbitmq
$data: string(4) "AMQP"
PHP Notice:  Undefined offset: 1 in /home/sites/citypay/citypay-payment-gateway/Lib/vendor/react/stomp/src/React/Stomp/Protocol/Parser.php on line 37
$data: string(0) ""
PHP Notice:  Undefined offset: 1 in /home/sites/citypay/citypay-payment-gateway/Lib/vendor/react/stomp/src/React/Stomp/Protocol/Parser.php on line 37
Could not connect: Received frame with command 'AMQP', expected 'CONNECTED'.
/react/stomp/examples$

Subscribing to non-existing topic causes parser error

Specifically in line 36 of \React\Stomp\Protocol\Parser.php

<?php
/*** snip ***/
public function parseFrameData($data)
{
        $frame = new Frame();

        list($head, $body) = explode("\n\n", $data, 2);

I don't know the protocol well enough to implement a proper fix for compensating when $data is empty.

Functional tests

Ideally we could test against multiple real MQs.

  • RabbitMQ
  • ActiveMQ

Heartbeat implementation

I'm curious about something. While looking at the network of this repository I've come across the branch of @capablue. They implemented the heartbeat functionality I was looking for and they apparently think it is stable enough because they've added a tag. After some testing locally this does suit our needs.

What I find most interesting is that I can't find any pull request or issues created by Capablue in this repository. Unfortunately the organisation doesn't have any public members so I'm unable to search more in depth and contact people. Is this something worth looking into? Perhaps even forking that repository and create a pull request myself?

I would like to continue to use the official stomp repository instead of a fork. Any thoughts, @igorw?

Link to repository: https://github.com/capablue/stomp

Memory leak

Hi! When I worked on this test, I have a problem - memory leak.



require __DIR__.'/../vendor/autoload.php';
$conf = require __DIR__ . '/config/apollo.php';

$loop = React\EventLoop\Factory::create();
$factory = new React\Stomp\Factory($loop);
$client = $factory->createClient($conf);

$client
    ->connect()
    ->then(function ($client) use ($loop) {
        $prevMessageCount = 0;
        $messageCount = 0;
        $loop->addPeriodicTimer(1, function () use (&$i, $client, &$messageCount) {     
        for ($i = 0; $i < 3000; $i++) {
                       $client->send('/queue/migration', 'Hello! This id message number '.$messageCount);
            echo "Posted this message: 'Hello! This id message number'.$messageCount.'\n";  
            $messageCount++;
            $kmem = memory_get_usage(true) / 1024;
            $mem  = memory_get_usage() / 1024;
            echo "Request: $i\n";
            echo "Memory: $mem KiB\n";
            echo "Real Memory: $kmem KiB\n";     
                }
        });
        $loop->addPeriodicTimer(1, function () use (&$prevMessageCount, &$messageCount) {
            $diff = $messageCount - $prevMessageCount;
            echo "Sent this second: $diff\n";
            $prevMessageCount = $messageCount;
        });
    }, function (\Exception $e) {
        echo sprintf("Could not connect: %s\n", $e->getMessage());
    });

$loop->run();

Testing my client with one listener. Different tests. When you send 100 messages per second, there is no memory leak. When posting more than 500 messages per second memory leaks in an arithmetic progression.

How can fix it?

Client creation failure does not trigger the promise rejection

In the following code, the exit('error'); is never triggered

The bug occurs whenever a process is listening to the port or not.

$loop = React\EventLoop\Factory::create();
$factory = new React\Stomp\Factory($loop);
$client = $factory->createClient(array('port' =>80));

$client
    ->connect()
    ->then(
         function () {},
         function () { exit("error"); }
    );

$loop->run();

STOMP 1.2

Introducing 1.2 support should likely have a 1.1 BC layer, since not many brokers support it yet (rabbit 3.0 does).

  • Replace the stomp spec in doc dir and README with v1.2
  • Support for \r\n
  • New heartbeat shizzle

InvalidFrameException

Any suggestions on where one should catch this exception? Looks like this is thrown in react/stomp/src/React/Stomp/Protocol/Parser.php:62

Does this happen before the promise is called or is there a way for us to catch this in the promise?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.