friends-of-reactphp / stomp Goto Github PK
View Code? Open in Web Editor NEWSTOMP bindings for ReactPHP.
License: MIT License
STOMP bindings for ReactPHP.
License: MIT License
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.
Since #33 react/promise v2 is supported. Can this be officially released?
Please show how to use the One-off timers.
For example, run php examples/publish.php rabbitmq
, shutdown Rabbit MQ server, see that it continues to send frames, no exception thrown
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$
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.
Ideally we could test against multiple real MQs.
Now react/socket available greater than 0.4 tagged version, please update your dependencies
In the readme it lists Transactions as a Todo.
Is that still the case?
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
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?
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();
It looks like this library only handles tcp:// protocol. Any plans to support ssl://?
Introducing 1.2 support should likely have a 1.1 BC layer, since not many brokers support it yet (rabbit 3.0 does).
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.