RxPHP / RxWebsocket

Websockets for PHP using Rx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dispose on MessageSubject subscription should close socket

mbonneau opened this issue · comments

With the following:

$client = new \Rx\Websocket\Client('ws://127.0.0.1:9090/ws');

$client->subscribe(function (MessageSubject $ms) {
    $disp = $ms->subscribe();

    addTimer(2, function () use ($disp) {
        echo "Dispose...\n";
        $disp->dispose();
    });
});

The websocket should close when there are no more subscriptions.

I have something that might help with this, will file a PR when I'm on the train to work 👍