2017 © Pedro Peláez
 

library websocket

The Hoa\Websocket library.

image

hoa/websocket

The Hoa\Websocket library.

  • Tuesday, January 23, 2018
  • by Hoa
  • Repository
  • 30 Watchers
  • 407 Stars
  • 60,693 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 69 Forks
  • 22 Open issues
  • 16 Versions
  • 8 % Grown

The README.md

Hoa , (*1)


Build status Code coverage Packagist License , (*2)

Hoa is a modular, extensible and structured set of PHP libraries.
Moreover, Hoa aims at being a bridge between industrial and research worlds. , (*3)

Hoa\Websocket

Help on IRC Help on Gitter Documentation Board, (*4)

This library allows to manipulate the WebSocket protocol and proposes a server and a client. It supports two specifications RFC6455 and Hybi (at the same time)., (*5)

Learn more., (*6)

Installation

With Composer, to include this library into your dependencies, you need to require hoa/websocket:, (*7)

$ composer require hoa/websocket '~3.0'

For more installation procedures, please read the Source page., (*8)

Testing

Before running the test suites, the development dependencies must be installed:, (*9)

$ composer install

Then, to run all the test suites:, (*10)

$ vendor/bin/hoa test:run

For more information, please read the contributor guide., (*11)

Quick usage

As a quick overview, we propose to start a websocket server and echo messages. The class Hoa\Websocket\Server proposes six listeners: open, message, binary-message, ping, close and error. Thus:, (*12)

$websocket = new Hoa\Websocket\Server(
    new Hoa\Socket\Server('ws://127.0.0.1:8889')
);
$websocket->on('open', function (Hoa\Event\Bucket $bucket) {
    echo 'new connection', "\n";

    return;
});
$websocket->on('message', function (Hoa\Event\Bucket $bucket) {
    $data = $bucket->getData();
    echo '> message ', $data['message'], "\n";
    $bucket->getSource()->send($data['message']);
    echo '< echo', "\n";

    return;
});
$websocket->on('close', function (Hoa\Event\Bucket $bucket) {
    echo 'connection closed', "\n";

    return;
});
$websocket->run();

Finally, we have to write a client in HTML and Javascript:, (*13)

<input type="text" id="input" placeholder="Message…" />












Here we are. All sent messages are echoed., (*14)

Awecode

The following awecodes show this library in action:, (*15)

  • Hoa\Websocket: why and how to use Hoa\Websocket\Server and Hoa\Websocket\Client? A simple example will illustrate the WebSocket protocol.

Documentation

The hack book of Hoa\Websocket contains detailed information about how to use this library and how it works., (*16)

To generate the documentation locally, execute the following commands:, (*17)

$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open

More documentation can be found on the project's website: hoa-project.net., (*18)

Getting help

There are mainly two ways to get help:, (*19)

Contribution

Do you want to contribute? Thanks! A detailed contributor guide explains everything you need to know., (*20)

License

Hoa is under the New BSD License (BSD-3-Clause). Please, see LICENSE for details., (*21)

The following projects are using this library:, (*22)

  • Marvirc, A dead simple, extremely modular and blazing fast IRC bot,
  • WellCommerce, Modern e-commerce engine built on top of Symfony 3 full-stack framework.

The Versions

23/01 2018

dev-master

9999999-dev https://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

09/01 2017

3.17.01.09

3.17.01.09 https://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

24/10 2016

3.16.10.24

3.16.10.24 https://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

05/07 2016

3.16.07.05

3.16.07.05 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

09/05 2016

3.16.05.09

3.16.05.09 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

15/03 2016

3.16.03.15

3.16.03.15 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

14/01 2016

3.16.01.14

3.16.01.14 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

11/01 2016

3.16.01.11

3.16.01.11 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

05/08 2015

2.15.08.05

2.15.08.05 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi rfc3986 rfc3629

29/05 2015

2.15.05.29

2.15.05.29 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi

16/02 2015

2.15.02.16

2.15.02.16 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi

09/12 2014

2.14.12.10

2.14.12.10 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi

24/09 2014

2.14.11.09

2.14.11.09 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi

23/09 2014

2.14.09.23

2.14.09.23 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi

16/09 2014

2.14.09.17

2.14.09.17 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi

16/09 2014

1.14.09.16

1.14.09.16 http://hoa-project.net/

The Hoa\Websocket library.

  Sources   Download

BSD-3-Clause

The Requires

 

library server client realtime websocket socket rfc6455 hybi