Live-Rates/live-rates.com

SSL routines:SSL_write:protocol is shutdown

valeriy-efimov opened this issue · 6 comments

after 10 second work
got error "SSL routines:SSL_write:protocol is shutdown"
image
what could be the problem?
my code

$client = new Client(new Version2X('https://wss.live-rates.com/'));
        $client->initialize();
        $client->emit('key', ['key' => '*********']);
        while (true) {
            $r = $client->read();
            var_dump($r);
}
        $client->close();

The demo is working fine, I have just tested it now and the sample code you pasted seems fine.
Try cloning the whole repo and run the php client.php, it should work.

The backtrace of the error you output is from a path that does not belong to the demo on this repo, you made a manual installation of elephant.io?

@acegilz yes i made a manual installation of elephant.io
Thanks, I'll try to clone now.

@acegilz yes i made a manual installation of elephant.io
Thanks, I'll try to clone now.

Great, please let me know if it works now.

@valeriy-efimov yes your version works. Thank!
now i get new error "Key Already Connected to Streaming Feed.. Disconnected!" But I don't use it anywhere for wss now.

@acegilz Hi again=)
I have a problem with your examle
after a couple of hours of work, your example just hangs in place and no longer continues to work. It's like an endless timeout.

$client->read();
script work hangs on this line
I ran my script in the supervisor, but due to the fact that here it just hangs up and does not give any errors, the supervisor does not even restart it.

        $client = new Client(new Version2X('https://us-wss.live-rates.com/'));
        $client->initialize();
        $client->emit('key', ['key' => env('LIVE_RATES_KEY')]);
        $tries = 0;
        $need_while = true;
        while ($need_while) {
            if($tries>5){
                $need_while = false;
                continue;
            }
            $r = $client->read();
            $array = json_decode($this->getBetween($r,"[","]"));
            $obj = json_decode($array[1]);

            if (!isset($obj->currency)) {
                var_dump($r);
                print("\n");
                $tries++;
            } else {
                $tries = 0;
                echo("Instrument: {$obj->currency} | Ask: {$obj->ask} | Bid: {$obj->bid}");
                print("\n");

            }
        }
        $client->close();

image
Here is an example of the situation.

The script is incomplete and hung on the line
$r = $client->read();

"Cloudflare Websocket Proxy Restarting"

Can you connect directly via eu-wss.live-rates.com, or us-wss.live-rates.com and see if the problem persists?

BTW: The nodejs client is much more optimised for socket.io. If you have possibility you may consider switching