2017 © Pedro Peláez
 

library socket

Library for building an evented socket server.

image

webbeta/socket

Library for building an evented socket server.

  • Thursday, July 31, 2014
  • by webBeta
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 93 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

Socket Component

Build Status, (*1)

Library for building an evented socket server., (*2)

The socket component provides a more usable interface for a socket-layer server or client based on the EventLoop and Stream components., (*3)

Server

The server can listen on a port and will emit a connection event whenever a client connects., (*4)

Connection

The connection is a readable and writable stream. It can be used in a server or in a client context., (*5)

Usage

Here is a server that closes the connection if you send it anything., (*6)

    $loop = React\EventLoop\Factory::create();

    $socket = new React\Socket\Server($loop);
    $socket->on('connection', function ($conn) {
        $conn->write("Hello there!\n");
        $conn->write("Welcome to this amazing server!\n");
        $conn->write("Here's a tip: don't say anything.\n");

        $conn->on('data', function ($data) use ($conn) {
            $conn->close();
        });
    });
    $socket->listen(1337);

    $loop->run();

You can change the host the socket is listening on through a second parameter provided to the listen method:, (*7)

    $socket->listen(1337, '192.168.0.1');

Here's a client that outputs the output of said server and then attempts to send it a string., (*8)

    $loop = React\EventLoop\Factory::create();

    $client = stream_socket_client('tcp://127.0.0.1:1337');
    $conn = new React\Socket\Connection($client, $loop);
    $conn->pipe(new React\Stream\Stream(STDOUT, $loop));
    $conn->write("Hello World!\n");

    $loop->run();

The Versions

31/07 2014

dev-master

9999999-dev

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

31/07 2014

dev-develop

dev-develop

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

25/05 2014

v0.4.2

0.4.2.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

13/04 2014

v0.4.1

0.4.1.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

17/02 2014

0.3.x-dev

0.3.9999999.9999999-dev

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

17/02 2014

v0.3.4

0.3.4.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

02/02 2014

v0.4.0

0.4.0.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

09/07 2013

v0.3.3

0.3.3.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

26/04 2013

v0.3.2

0.3.2.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

20/04 2013

v0.3.1

0.3.1.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

21/01 2013

v0.3.0

0.3.0.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

14/12 2012

v0.2.6

0.2.6.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

05/11 2012

v0.2.3

0.2.3.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

10/09 2012

v0.2.0

0.2.0.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

12/07 2012

v0.1.1

0.1.1.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket

11/07 2012

v0.1.0

0.1.0.0

Library for building an evented socket server.

  Sources   Download

MIT

The Requires

 

socket