2017 © Pedro Peláez
 

library stomp

STOMP bindings for React.

image

react/stomp

STOMP bindings for React.

  • Friday, March 30, 2018
  • by WyriHaximus
  • Repository
  • 20 Watchers
  • 87 Stars
  • 36,632 Installations
  • PHP
  • 4 Dependents
  • 1 Suggesters
  • 37 Forks
  • 12 Open issues
  • 9 Versions
  • 3 % Grown

The README.md

React/STOMP

STOMP bindings for React., (*1)

STOMP is a messaging protocol. It is supported by most message queue brokers, such as RabbitMQ, Apollo and many others., (*2)

A message queue is used for asynchronous inter-process communication. This can be useful for workers, general long-running tasks, or communication between long-running daemons., (*3)

Build Status Code Climate, (*4)

Install

The recommended way to install react/stomp is through composer., (*5)

{
    "require": {
        "react/stomp": "0.1.*"
    }
}

Example

You can interact with a STOMP server by using the React\Stomp\Client., (*6)

<?php

$loop = React\EventLoop\Factory::create();
$factory = new React\Stomp\Factory($loop);
$client = $factory->createClient(array('vhost' => '/', 'login' => 'guest', 'passcode' => 'guest'));

$client
    ->connect()
    ->then(function ($client) use ($loop) {
        $client->subscribe('/topic/foo', function ($frame) {
            echo "Message received: {$frame->body}\n";
        });

        $loop->addPeriodicTimer(1, function () use ($client) {
            $client->send('/topic/foo', 'le message');
        });
    });

$loop->run();

Options

  • host: Host to connect to, defaults to 127.0.0.1.
  • port: Port to connect to, defaults to 61613 (rabbitmq's stomp plugin).
  • vhost: Virtual host, defaults to /.
  • login: Login user name, defaults to guest.
  • passcode: Login passcode, defaults to guest.

Acknowledgement

When subscribing with the subscribe method, messages are considered acknowledged as soon as they are sent by the server (ack header is set to 'auto')., (*7)

You can subscribe with a manual acknowledgement by using subscribeWithAck (see SUBSCRIBE in the STOMP spec for available ack mode values)., (*8)

You will get a React\Stomp\AckResolver as second argument of the callback to acknowledge or not the message :, (*9)

$client->subscribeWithAck('/topic/foo', 'client', function ($frame, $ackResolver) {
    if ($problem) {
        $ackResolver->nack();
    } else {
        $ackResolver->ack();
    }
});

Todo

  • Support nul bytes in frame body
  • Heart-beating
  • Consuming ACKs
  • Transactions
  • Streaming frame bodies (using stream API)

Tests

To run the test suite, you need PHPUnit., (*10)

$ phpunit

License

MIT, see LICENSE., (*11)

Resources

The Versions

30/03 2018

dev-master

9999999-dev

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

The Development Requires

rabbitmq stomp

29/11 2014

v0.2.0

0.2.0.0

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

The Development Requires

rabbitmq stomp

15/04 2013

v0.1.4

0.1.4.0

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

rabbitmq stomp

15/01 2013

v0.1.3

0.1.3.0

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

rabbitmq stomp

27/12 2012

v0.1.2

0.1.2.0

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

rabbitmq stomp

26/12 2012

v0.1.1

0.1.1.0

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

rabbitmq stomp

19/11 2012

dev-stream-primitives

dev-stream-primitives

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

rabbitmq stomp

16/11 2012

dev-connect-promise

dev-connect-promise

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

rabbitmq stomp

14/11 2012

v0.1.0

0.1.0.0

STOMP bindings for React.

  Sources   Download

MIT

The Requires

 

rabbitmq stomp