Giter Club home page Giter Club logo

Comments (3)

melode11 avatar melode11 commented on July 28, 2024

Seems like your code reaches to the end too early, where triggers the destructor of the sio::client, which will call sync_close as well.
Try to block your execution some where.

from socket.io-client-cpp.

Francis0121 avatar Francis0121 commented on July 28, 2024

So I wrote a while statement at the end of the source code.
(Line number:143 https://github.com/Francis0121/nornenjs_v3/blob/master/client-tizen-socket-io/src/socket_io_client.cpp)
Like this, i can use socket event bind.

But when I close my tizen application, client does not close. At the same time server is dead.
How can i call sio::client destructor in the main loop?

And I'd like to know about your library design architecture in Ios Application.

from socket.io-client-cpp.

melode11 avatar melode11 commented on July 28, 2024
  1. please use debug mode to start your server
DEBUG=* node index.js

See what's happened when your server is dying.

Usually OS will close the physical connection for terminated applications. So your problem is Server do not know client is closed rather than client does not closed. Client is actually closed, but server do not know that. It will also happen if your application is abnormally terminated or network is drop.

If you want server to know when client is closed, please make sure to call client.sync_close() once you detect your application is exiting.

Also, It is important to have some defensive code in the server side to deal with the case that client is drop without notification.

  1. You can refer to the iOS demo
    https://github.com/socketio/socket.io-client-cpp/tree/master/examples/iOS

from socket.io-client-cpp.

Related Issues (20)

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.