Skip to content
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

Double call of subscribe disconnect the PubNub #158

Closed
akuzminskyi opened this issue Mar 11, 2024 · 6 comments
Closed

Double call of subscribe disconnect the PubNub #158

akuzminskyi opened this issue Mar 11, 2024 · 6 comments
Labels
priority: high This PR should be reviewed ASAP. status: done This issue is considered resolved. type: bug This issue reports a bug.

Comments

@akuzminskyi
Copy link

akuzminskyi commented Mar 11, 2024

Hi, is it expected behavior if we call pubNub.subscribe(to: "channel_id") twice the PubNub disconnects?

I'm using 7.0.0 SDK

@mohitordex
Copy link

Facing same issue on 7.0.0 SDK

@jguz-pubnub
Copy link
Contributor

jguz-pubnub commented Mar 12, 2024

Hi @akuzminskyi, @mohitordex

Here's a unit test I wrote to reproduce your scenario. Is this what you meant?

func testSubscribeTheSameChannel() {
  let expectation = XCTestExpectation(description: "Test Subscribe Twice")
  expectation.assertForOverFulfill = true
  expectation.expectedFulfillmentCount = 2
  
  pubnub.onConnectionStateChange = { newStatus in
    switch newStatus {
    case .connecting:
      expectation.fulfill()
    case .connected:
      expectation.fulfill()
    default:
      XCTFail("Unexpected connection status")
    }
  }
  
  pubnub.subscribe(to: ["channel"])
  pubnub.subscribe(to: ["channel"])
  
  XCTAssertEqual(pubnub.subscribedChannels, ["channel"])
  wait(for: [expectation], timeout: 1)
}

@akuzminskyi
Copy link
Author

@jguz-pubnub yes, looks like that.
try to add an assert after the subscribe lines

pubnub.subscribe(to: ["channel"])
pubnub.subscribe(to: ["channel"])
XCTAssertNotEqual(pubnub.connectionStatus, .disconnected)

@jguz-pubnub jguz-pubnub added priority: high This PR should be reviewed ASAP. status: in progress This issue is being worked on. type: bug This issue reports a bug. labels Mar 12, 2024
@akuzminskyi
Copy link
Author

@jguz-pubnub I see you marked it as a bug, can you please let us know from which version we have this issue? to understand the impact of the issue for companies that use the PubNub

@jguz-pubnub
Copy link
Contributor

jguz-pubnub commented Mar 12, 2024

@akuzminskyi this issue occurs in the 7.0.0 version only. It happens if you subscribe to the channel that was already subscribed

@akuzminskyi
Copy link
Author

I can confirm the issue is not happening anymore in 7.1.0 for me.

@jguz-pubnub jguz-pubnub added status: done This issue is considered resolved. and removed status: in progress This issue is being worked on. labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high This PR should be reviewed ASAP. status: done This issue is considered resolved. type: bug This issue reports a bug.
Projects
None yet
Development

No branches or pull requests

3 participants