Posts

Showing posts with the label sockets

Socket connection in background

Socket connection in background I need to make an application where, while the user is authorized, it keeps the socket connection until it is logged out. For this purpose, a foreground service is created, which starts after the authorization of the user, and stops when it is logged out. It implements connection and reconnection on the socket. All works well until you press the power button and turn off the charging. After this, the user stops receiving pongs from the server and the SocketTimeoutException is received on the OkHttp, and also stops receiving messages on the socket. On JavaWebsocket The connection was closed because the other endpoint did not respond with a pong in time. is received, after which you can successfully create a new socket connection, but it will repeat the same problem in the loop. In the settings, the optimization of the battery for this application was disabled. What can I do to make a stable connection socket work in the background? Implementation of acti...

Socket.io client disconnects due to ping timeout / transport closed

Image
Socket.io client disconnects due to ping timeout / transport closed Here's my setup: Raspberry Pi 2 (192.168.1.101): Raspberry Pi 3 (192.168.1.100): Misc: This setup seems to be working. The Python script is sending data to the node server, which is forwarding it on to any web client connected, which is displayed correctly on the website. My issue is that the web client disconnects after 1 round of ping/pong between the client and node server. Here's the chrome console log when connected to the server and receiving data: The web client connects, receives some data, does a ping/pong with the server, receives some more data, then when it's supposed to ping/pong again it disconnects, then after a while it tries reconnecting and the cycle continues. And here's the node.js log: The first New Connection is the Python client (I'm not sure why the IP is the Pi3 address), the rest are the same web client connecting, being disconnected for ping time out, then reconnecting. T...

Sending live video frame over network to a remote server in python opencv [closed]

Sending live video frame over network to a remote server in python opencv [closed] I am trying to send frames that I am catching with my camera using opencv to a remote server, I tried to build a Rest Service using Flask, also I tried to use the socket, but the problem with this two solution is that both are too slow, and I'am looking for a real time solution. Can someone help? Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question. probably not the sockets are too slow but your bandwidth isn't big enough. Calculate your bandwidth needs by image width times image height times bits per pixel times frames per second. Typically you'll need some good image encoding, if you don't use a gigabi...