Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients connects after timeout #156

Open
MarcoAzk opened this issue Sep 6, 2024 · 0 comments
Open

Clients connects after timeout #156

MarcoAzk opened this issue Sep 6, 2024 · 0 comments

Comments

@MarcoAzk
Copy link

MarcoAzk commented Sep 6, 2024

Hello, version used 0.3.5
Sometimes my clients are able to connect to a ratchet server (on the same server) also after the timeout defined in the connector (5 seconds):

public function callWSS() {
        $this->commandexecuted = false;
        $loop = \React\EventLoop\Factory::create();
        $reactConnector = new \React\Socket\Connector($loop, [
            'timeout' => 5.0
        ]);

        appDebug($this->servicename, $this->json['transactionId'],'Try to connect to WebSocket Server on "' . $this->wsServerHost);

        $connector = new \Ratchet\Client\Connector($loop, $reactConnector);

        $wsurl = "ws://{$this->wsServerHost}:{$this->wsServerPort}/{$this->wsServerPath}"

        $connector( $wsurl )->then(
        //resolve
            function( \Ratchet\Client\WebSocket $conn) use ($loop) {
                appDebug($this->servicename, $this->json['transactionId'],'Connected successfully to WebSocket Server  on "' . $this->wsServerHost);
            }
        );
        $loop->run();
    }

This is an sample of the log i got with 25 seconds after calling connection
[2024-09-02 21:30:07] production.DEBUG: | 5a2b765f-48c0-4d81-8c4a-e66b615f8450 | Try to connect to WebSocket Server on "127.0.0.1
[2024-09-02 21:30:32] production.DEBUG: | 5a2b765f-48c0-4d81-8c4a-e66b615f8450 | Connected successfully to WebSocket Server on "127.0.0.1

Am i faulting somewhere?

Thanks
Marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant