Skip to content

Commit d1a904c

Browse files
authored
Update push-uniapp.js
1 parent 2e3ee85 commit d1a904c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/push-uniapp.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,13 @@ function createPresenceChannel(channel_name, push)
190190
}
191191

192192
uni.onNetworkStatusChange(function (res) {
193-
for (var i in Push.instances) {
194-
con = Push.instances[i].connection;
195-
con.reconnectInterval = 1;
196-
if (con.state === 'connecting') {
197-
con.connect();
193+
if(res.isConnected) {
194+
for (var i in Push.instances) {
195+
con = Push.instances[i].connection;
196+
con.reconnectInterval = 1;
197+
if (con.state === 'connecting') {
198+
con.connect();
199+
}
198200
}
199201
}
200202
});

0 commit comments

Comments
 (0)