2017 © Pedro Peláez
 

library websocket

PHP websocket server and client

image

vakata/websocket

PHP websocket server and client

  • Thursday, March 8, 2018
  • by vakata
  • Repository
  • 5 Watchers
  • 23 Stars
  • 586 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 4 Open issues
  • 3 Versions
  • 24 % Grown

The README.md

websocket

Latest Version on Packagist ![Software License][ico-license], (*1)

PHP websocket server and client. Supports secure sockets., (*2)

Install

Via Composer, (*3)

``` bash $ composer require vakata/websocket, (*4)


## Server usage ``` php // this handler will forward each message to all clients (except the sender) $server = new \vakata\websocket\Server('ws://127.0.0.1:8080'); $server->onMessage(function ($sender, $message, $server) { foreach ($server->getClients() as $client) { if ($client !== $sender) { $client->send($message); } } }); $server->run();

Client usage

``` php // this handler will echo each message to standard output $client = new \vakata\websocket\Client('ws://127.0.0.1:8080'); $client->onMessage(function ($message, $client) { echo $message . "\r\n"; }); $client->connect();, (*5)


## Usage in HTML ``` js var sock = new WebSocket('ws://127.0.0.1:8080/'); sock.send("TEST");

Contributing

Please see CONTRIBUTING for details., (*6)

Security

If you discover any security related issues, please email github@vakata.com instead of using the issue tracker., (*7)

Credits

License

The MIT License (MIT). Please see License File for more information., (*8)

The Versions

08/03 2018

dev-master

9999999-dev https://github.com/vakata/websocket

PHP websocket server and client

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

websocket vakata

27/10 2016

1.0.1

1.0.1.0 https://github.com/vakata/websocket

PHP websocket server and client

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

websocket vakata

17/02 2016

1.0.0

1.0.0.0 https://github.com/vakata/websocket

PHP websocket server and client

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

websocket vakata