Thanks to visit codestin.com
Credit goes to github.com

Skip to content

daddyofsky/php-websocket-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WebSocket Client for PHP

WebSocket Client for PHP >= 7.0
You can use WebSocketClient or WebSocketCliClient by environment or your favorite.

Usage

WebSocketClient

For web and CLI environment.

Example:

$client = new WebSocketClient('127.0.0.1', 9502);

$client->connect();
$client->recv(); // hello

$client->push('Some Data');
$body = $client->recv();
var_dump($body);

$client->close();

WebSocketCliClient

For CLI environment only but can use async mode with more performance..
This class need to install openswoole php extension.

Example:

use Swoole\Coroutine as Co;

Co\run(function() {
    $client = new WebSocketCliClient('127.0.0.1', 9502);
    $client->connect();
    $client->recv(); // hello

    $client->push('Some Data');
    $body = $client->recv();
    var_dump($body);

    $client->close();
});

Referred

License

MIT

About

WebSocket Client for PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages