Giter VIP home page Giter VIP logo

Comments (8)

sannremy avatar sannremy commented on August 23, 2024

How can we reproduce that?

from php-push-websocket.

mruz avatar mruz commented on August 23, 2024

For me it happens when:
Run your code in the verbose mode.
Add another client (eg. 3).
Close some tab (eg. 2) in the web browser.
Wait a moment.

I'm using:
openSUSE Tumblewed 20160117
php-fpm 5.6.17 (cli)

from php-push-websocket.

mruz avatar mruz commented on August 23, 2024

@srchea did you reproduce it?

from php-push-websocket.

mruz avatar mruz commented on August 23, 2024

I think I haven't window.onbeforeunload, so it works, but how about Performing action: � and receiving data from client after quit?

[2016-04-05 02:30:57] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:30:57] Finding the socket that associated to the client...
[2016-04-05 02:30:57] Client found
[2016-04-05 02:30:57] Receiving data from the client #570369a4e4a62
[2016-04-05 02:30:57] Performing action: quit
[2016-04-05 02:30:57] Killing a child process
[2016-04-05 02:30:57] Process 14502 is killed!
[2016-04-05 02:30:57] Finding the socket that associated to the client...
[2016-04-05 02:30:57] Client found
[2016-04-05 02:30:57] Receiving data from the client #570369a4e4a62
[2016-04-05 02:30:57] Performing action: �
[2016-04-05 02:31:03] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:31:08] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:31:18] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:31:27] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:31:37] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:31:43] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:31:52] Send 'Client ID: 570369a70e990' to client #570369a70e990
[2016-04-05 02:31:57] Finding the socket that associated to the client...
[2016-04-05 02:31:57] Client found
[2016-04-05 02:31:57] Receiving data from the client #570369a4e4a62
[2016-04-05 02:31:57] Disconnecting client #570369a4e4a62
[2016-04-05 02:31:57] Socket closed
[2016-04-05 02:31:57] Client #570369a4e4a62 disconnected

I added disconnect if action is quit:

if ($action == "exit" || $action == "quit") {
    //...
    $this->disconnect($client);

And now:

[2016-04-05 02:39:58] Finding the socket that associated to the client...
[2016-04-05 02:39:58] Client found
[2016-04-05 02:39:58] Receiving data from the client #57036bc2e484b
[2016-04-05 02:39:58] Performing action: quit
[2016-04-05 02:39:58] Killing a child process
[2016-04-05 02:39:58] Process 14614 is killed!
[2016-04-05 02:39:58] Disconnecting client #57036bc2e484b
[2016-04-05 02:39:58] Socket closed
[2016-04-05 02:39:58] Client #57036bc2e484b disconnected

Is it good?

from php-push-websocket.

sannremy avatar sannremy commented on August 23, 2024

@mruz Nope, I wasn't able to reproduce it. :( Yes, when you close a tab, the client sends a 'quit' action: ws.send('quit'); to the WebSocket server!

from php-push-websocket.

mruz avatar mruz commented on August 23, 2024

Still broken pipe. Maybe window.onbeforeunload not cover all exits?

ErrorException[2]: socket_write(): unable to write to socket [32]: Broken pipe
ErrorException[2]: socket_write(): unable to write to socket [104]: Connection reset by peer

on line

 if (socket_write($client->getSocket(), $text, strlen($text)) === false) {

ErrorException[2]: socket_shutdown(): unable to shutdown socket [107]: Transport endpoint is not connected

on line

socket_shutdown($client->getSocket(), 2);

from php-push-websocket.

sannremy avatar sannremy commented on August 23, 2024

I'll check :)

from php-push-websocket.

mruz avatar mruz commented on August 23, 2024

Thanks, maybe we can check socket_last_error() before socket_write()?

from php-push-websocket.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.