Wrong presence channel behavior (Android/IOS)
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- mobile-dev
調査の方向性
The problem is in PresenceChannelImpl, in handleSubscriptionSuccessfulMessage, where idToUserMap is filled with put() calls but never cleared before the new user list is applied. Start by reading how idToUserMap is maintained across unsubscribe and resubscribe in PresenceChannelImpl. Done means that after a reconnect, getUsers() reflects only the users in the subscription_succeeded payload, and that a test covers a member leaving while the client was disconnected.
索引モデルが issue の本文から書いたものです。
説明
What is the issue?
Hello there! I found some incorrect behavior of presence channels after restore connection to channel.
Problem step-by-step:
- Connect to presence channel two or more users
- Go to in background - pusher disconnected
- Other users quit from channel
- Go to in foreground - pusher connected - we resubscribe to channel
- On onUsersInformationReceived we got old data of users in channel
Notate: Swift SDK has workaround with subscribing on "pusher:subscription_succeeded" and process this event separate from flow logic. In Java SDK we don't have such trick...
In PresenceChannelImpl when channel successfully subscribed we got event SUBSCRIPTION_SUCCESS_EVENT = "pusher_internal:subscription_succeeded" with processing in internal channel body and after that call onUsersInformationReceived for self interface.
Problem in idToUserMap map witch need to clear in this case, because if i'm not wrong with SUBSCRIPTION_SUCCESS_EVENT we getting actual data about users in presence channel but in current realisation we lost users who quit from channel while i was unsubscibed.
Debug of this point shown that problem exist - channel got json with 1 user but idToUserMap not cleared and return wrong users data
...
Is it a crash report? Submit stack traces or anything that you think would help
#class PresenceChannelImpl
@SuppressWarnings({ "rawtypes", "unchecked" })
private void handleSubscriptionSuccessfulMessage(final String message) {
final ChannelEventListener listener = getEventListener();
// extract data from the JSON message
final PresenceData presenceData = extractPresenceDataFrom(message);
if (presenceData == null) {
if (listener != null) {
listener.onError(
"Subscription failed: Presence data not found",
null
);
}
return;
}
final List<String> ids = presenceData.ids;
final Map<String, Object> hash = presenceData.hash;
if (ids != null && !ids.isEmpty()) {
// build the collection of Users
for (final String id : ids) {
final String userData = hash.get(id) != null ? GSON.toJson(hash.get(id)) : null;
final User user = new User(id, userData);
idToUserMap.put(id, user); <--- Problem - is not empty. Suggestion: need clear before process users data
}
}
if (listener != null) {
final PresenceChannelEventListener presenceListener = (PresenceChannelEventListener)listener;
presenceListener.onUsersInformationReceived(getName(), getUsers());
}
}
...
Any improvements you suggest
In this case clear idToUserMap before process users data. I may be wrong, then tell me the correct scenario for working with this type of channels
...
CC @pusher/mobile
- 主要言語
- Java
- スター
- 315
- フォーク
- 140
- 平均マージ
- 11日 5時間
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pusher/pusher-websocket-java のほかの issue
-
FileNotFoundException thrown when server responds with 400 or above対応中かも @RaphaelFakhri が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
pusher/pusher-websocket-java#261 ·
-
java.lang.NoClassDefFoundError: com.pusher.client.Pusher$$ExternalSyntheticLambda0 on Android API 21-22 anyway対応中かも @Keith-wright が 8 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
pusher/pusher-websocket-java#366 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
pusher/pusher-websocket-java#340 · コメント 3 件 · リアクション 7 件 ·
-
難易度 4/5 1〜2日 初心者へのやさしさ 8/100
pusher/pusher-websocket-java#311 · コメント 4 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 12/100
pusher/pusher-websocket-java#308 · コメント 2 件 ·
pusher/pusher-websocket-java の issue をすべて見る
似ている issue
-
bug/错误
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
FCL-Team/FoldCraftLauncher#1982 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] micronaut-serde-oracle-jdbc-json brings a second OJDBC driver onto the runtime classpath対応中かも @ZARAYACH が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
micronaut-projects/micronaut-serialization#1494 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
vitruv-tools/Vitruv-Change#600 ·
メンテナーはふだん 1 日以内に返信
-
code-health feature/sync OS/Android QA/Test-Plan-Specified QA/Yes
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
brave/brave-browser#60327 ·
メンテナーはふだん 1 日以内に返信