Skip to content

hi. i have a problem with tizen application #2

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

Closed
Francis0121 opened this issue Apr 7, 2015 · 3 comments
Closed

hi. i have a problem with tizen application #2

Francis0121 opened this issue Apr 7, 2015 · 3 comments

Comments

@Francis0121
Copy link

Hi. I'm trying to build your source code to Tizen. But there is a problem. Tizen is c language based. I want to receive messages on the server in real time. I have a call using the pthread the socket_io_client () function. But the connection was successful, but the right end close () is called.
How can i use your source code in c language environment?

There socket_io_client () is in the link below.
https://github.com/Francis0121/nornenjs_v3/blob/master/client-tizen-socket-io/src/socket_io_client.cpp

@melode11
Copy link
Contributor

melode11 commented Apr 7, 2015

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.

@Francis0121
Copy link
Author

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.

@melode11
Copy link
Contributor

melode11 commented Apr 8, 2015

  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

Piasy pushed a commit to HackWebRTC/socket.io-client-cpp that referenced this issue Jan 28, 2020
Consider all client-initiated closes to be close_reason_normal.
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

2 participants