Skip to content

avastamin/php-websocket-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebSocket client

A simple WebSocket client implemented in php.

Requirements

This library uses PHP 5.3+.

Install

It is recommended that you install the WebSocket client library through composer.

{
    "require": {
        "symbiose/websocket-client": "dev-master"
    }
}

Usage

Here is an example of a simple WebSocket client:

class Client implements WebSocketClient\WebSocketClientInterface {
    private $client;

    public function onMessage($data) {}

    public function sendData($data) {
        $this->client->sendData($data);
    }

    public function setClient(WebSocketClient $client) {
        $this->client = $client;
    }
}

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

$client = new WebSocketClient(new Client, $loop);

$loop->run();

About

A simple PHP WebSocket client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%