PHP code example of jiaozi / protocol_json_stream

1. Go to this page and download the library: Download jiaozi/protocol_json_stream library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jiaozi / protocol_json_stream example snippets



use Workerman\Worker;

127.0.0.1:1000");
// all you need to do is setting the protocol
$woker->protocol = \pjs\protocols\JsonStreamProtocol::class;
$woker->onMessage = function(Workerman\Connection\ConnectionInterface $conn, $data){
    var_dump($data);
};

Worker::runAll();


his package contains a simple client for message transfer. 
$client = new \pjs\ClientConnection("127.0.0.1:1000");
$client->connect();
$client->send(['hello' => 'hello']);