Skip to content

Commit

Permalink
WIP don’t use private APIs in closeAndFinish
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-forooghian committed Jun 27, 2024
1 parent 1c0126c commit 055a8d7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/common/modules/shared_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,18 @@ define([
}

_callbackOnClose(realtime, callback) {
this.recordPrivateApi('read.connectionManager.activeProtocol');
if (!realtime.connection.connectionManager.activeProtocol) {
if (realtime.connection.state === 'closed' || realtime.connection.state === 'failed') {
this.recordPrivateApi('call.Platform.nextTick');
platform.Config.nextTick(function () {
realtime.close();
callback();
});
return;
}
this.recordPrivateApi('read.connectionManager.activeProtocol.transport');
this.recordPrivateApi('listen.transport.disposed');
realtime.connection.connectionManager.activeProtocol.transport.on('disposed', function () {

realtime.connection.once(['closed', 'failed'], function () {
callback();
});

/* wait a tick before closing in order to avoid the final close
* happening synchronously in a publish/attach callback, which
* complicates channelattach_publish_invalid etc. */
Expand Down

0 comments on commit 055a8d7

Please sign in to comment.