io客户端或断开它暂停

io客户端或断开它暂停

本文介绍了在PhoneGap的简历保存socket.io客户端或断开它暂停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用socket.io作为通信手段的PhoneGap应用程序。当应用程序进入暂停插座在后台保持活力明显,并在简历页面加载时它用一个新的取代了旧的插座,并创建一个新的套接字。通过每一份简历套接字连接是一个。

I have a phonegap application which uses socket.io as means of communication. When application goes to pause the socket is kept alive in the background apparently, and on resume when the page loads it replaces the old socket with a new one, and creates a new socket. By each resume socket connections are one more.

有没有办法保持旧插座连接时,应用程序恢复?
或者当应用程序暂停断开呢?
我使用的PhoneGap-WebSocket的。

Is there a way to keep the old socket connection when application resumes?Or to disconnect it when the application pauses?I'm using phonegap-websocket.

推荐答案

我有一个类似的问题。我也有一个WebSocket的连接,这一次应该应用程序被带到前台再次被放倒,当应用程序发送到后台,并重新开放。

I have a similar issue. I also have a websocket-connection, that ought to be brought down when the app is sent to the background and reopened once the app is brought to the foreground again.

根据文档,我会使用暂停事件推倒的通信,然后在接收到恢复事件重新打开插座。但是,这仅仅只要作品有keepRunning设置为true(请参阅)。

According to documentation, I'd use the "pause" event to tear down the communication and then reopen the socket when the "resume" event is received. But this only works as long as "keepRunning" is set to true (see keepRunning set to false - what does it really do on Android?).

这篇关于在PhoneGap的简历保存socket.io客户端或断开它暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 12:46