#!/usr/bin/env php
<?php

require __DIR__ . '/../../../autoload.php';

use Inhere\WebSocket\Client\ClientFactory;

define('PROJECT_PATH', __DIR__);

$options = [
    'debug' => true,
    'driver' => '',
    'headers' => [
        'test-name' => 'value'
    ],
    'cookies' => [
        'test' => 'value',
        'test1' => 'value1',
    ]
];

// $client = ClientFactory::make('ws://127.0.0.1:9501', $options);
$client = ClientFactory::parseOptMake($options);

$client->connect();

echo $client->receive() . PHP_EOL;

$client->send('hello');

echo $client->receive() . PHP_EOL;

$client->close();
