GeniusesOfSymfony / WebSocketBundle

:part_alternation_mark: Websocket server for Symfony applications (powered by Ratchet), includes a Autobahn.JS based JavaScript client
MIT License
609 stars 140 forks source link

Connection auto closes right after first incomming message #452

Closed AndreRudolph closed 2 years ago

AndreRudolph commented 2 years ago

Hi,

awesome bundle and thanks for your work!

However I wanted to start using this bundle and I am facing an issue that the client connection gets closed automatically right after it receives the first incomming message. I set breakpoints in the WampApplication class in onOpen and onClose method and onOpen gets called first and immediately afterwards the onClose method.

I traced it down to the class React\Stream\WritableResourceStream method handleWrite.

       if ($this->data === '') {
            // stop waiting for resource to be writable
            if ($this->listening) {
                $this->loop->removeWriteStream($this->stream);
                $this->listening = false;
            }

            // buffer is end()ing and now completely empty => close buffer
            if (!$this->writable) {
                $this->close();
            }
        }

The connection seems to be closed by this code. Do you have any suggestions how can I find the root cause of this? Can it be related to a misuse of the javascript client or is it rather a server problem? In the logs (symfony & php logs) there are no exceptions or errors logged.

Would really appreciate your help and thanks in advance!

AndreRudolph commented 2 years ago

Sorry, it was just because of a misuse of the JS client.