2017 © Pedro Peláez
 

library reactmongrel2

Mongrel2 bindings for Reactphp.

image

starship/reactmongrel2

Mongrel2 bindings for Reactphp.

  • Friday, February 8, 2013
  • by evan108108
  • Repository
  • 2 Watchers
  • 6 Stars
  • 62 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Starship/ReactMongrel2

Mongrel2 bindings for ReactPHP. Provides a simple rapper for easy connection to Mongrel2 web-server., (*1)

Install

The recommended way to install react/mongrel2 is through composer., (*2)

{
    "require": {
        "starship/reactmongrel2": "dev-master"
    }
}

Example

Hello World; Connecting a React process to Mongrel2:, (*3)

helloMongrel2.php

require __DIR__.'/vendor/autoload.php';

$loop = React\EventLoop\Factory::create(); //Create The React Loop

    //Mongrel2 Setup ------------------------------------------
    //---------------------------------------------------------
    $m2 = new Starship\ReactMongrel2\Connect(
        '82209006-86FF-4982-B5EA-D1E29E55D481', //Sender ID 
        'tcp://127.0.0.1:9997', //recv_spec
        'tcp://127.0.0.1:9996', //send_spec
        $loop //React Event LoopInterface 
    );
    //---------------------------------------------------------
    //---------------------------------------------------------

    //Handel incoming and outgoing requests -------------------
    //---------------------------------------------------------
    $m2->on('read.message', function ($msg) use ($m2) { 
        echo $msg . "\n\n";
        $m2->send($msg, '<h1>Hello From React PHP</h1>');
    });
    //---------------------------------------------------------
    //---------------------------------------------------------

    //Handle comm errors --------------------------------------
    //---------------------------------------------------------
    $m2->on('read.error', function ($e) {
            var_dump($e->getMessage());
    });

    $m2->on('write.error', function ($e) {
            var_dump($e->getMessage());
    });
    //---------------------------------------------------------
    //---------------------------------------------------------

$loop->run(); //Start the loop

mongrel2.conf

hello_handler = Handler(
    send_spec='tcp://*:9997', 
    send_ident='ab206881-6f49-4276-9db1-1676bfae18b0',
    recv_spec='tcp://*:9996', recv_ident=''
)

main = Server(
    uuid="9e71cabf-6afb-4ee1-b550-7972245f7e0a",
    access_log="/logs/access.log",
    error_log="/logs/error.log",
    chroot="./",
    default_host="localhost",
    name="codebanger",
    pid_file="/run/mongre2.pid",
    port=6767,
    hosts = [
        Host(name="localhost", routes={'/hello':hello_handler})
    ]
)

servers = [main]

The Versions

08/02 2013

dev-master

9999999-dev

Mongrel2 bindings for Reactphp.

  Sources   Download

MIT

The Requires

 

The Development Requires

  • ext-pcntl *

zmq react mongrel2 mongrel

21/12 2012

v0.1.2

0.1.2.0

Mongrel2 bindings for React.

  Sources   Download

MIT

The Requires

 

The Development Requires

  • ext-pcntl *

mongrel2 mongrel

21/12 2012

v0.1.1

0.1.1.0

Mongrel2 bindings for React.

  Sources   Download

MIT

The Requires

 

The Development Requires

  • ext-pcntl *

mongrel2 mongrel