Skip to content
Sockets implementation using Expressif streams
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Expressif/Socket
test
.gitignore
LICENSE
README.md
composer.json

README.md

socket

Sockets implementation using Expressif streams

usage :

<?php

  require 'vendor/autoload.php';
  use Expressif\Socket\Server;
  use Expressif\Socket\Client;

  $endpoint = 'tcp://127.0.0.1:1337';
  echo "Starting the server at $endpoint\n";

  $server = new Server($endpoint);
  $server->on('connection', function($client) use() {
    $client->on('data', function($name) use($client) {
      $client->write('Hello '.$name)->close();
    });
  });


  $c = new Client($endpoint);
  $c->send('James Bond')->on('data', function($greetings) {
    echo "<< $greetings\n";
  });
You can’t perform that action at this time.