twilio / twilio-chat-demo-android

Chat API Demo Application for Android
MIT License
62 stars 51 forks source link

Channel uniqueName not found in onChannelDelete(channel: Channel) Callback #113

Closed ajitdubey-mob-ibtech closed 3 years ago

ajitdubey-mob-ibtech commented 5 years ago

Description

Channel unique name not found in the channel once receive a callback **override fun onChannelDeleted(channel: Channel?)*** Even you can see the friendly name, SID and type available.

Steps to Reproduce

  1. User Create a channel and send an invite to a participant
  2. The same user accepted the invite and joined into the channel
  3. Admin deletes the channel which is created in Step 1
  4. The participant receives a callback in onChannelDeleted(channel: Channel?). In this callback channel, a unique name is blank.

Application server Code

@Override
  public boolean deleteChannel(String channelSId) throws ApiException {
    Twilio.init(externalCredential.getProperty(TwilioConstants.TWILIO_ACCOUNT_SID_KEY), externalCredential.getProperty(TwilioConstants.TWILIO_AUTH_TOKEN_KEY));
    ChannelDeleter channelDeleter = Channel.deleter(externalCredential.getProperty(TwilioConstants.TWILIO_SERVICE_SID_KEY), channelSId);
    return channelDeleter.delete();
}

Expected Behavior

Channel unique name should be there in the channel?.uniqueName

Actual Behavior

Channel unique name not found

Reproduces how Often

100%

Logs

1573815073.079  V/TWC:       |      4 | Twilsock.Client | onMessageReceived (676)
    TWILSOCK V3.0 185
    {"method":"notification","id":"TMbd8b71c100134d14b8f5abf1a4196cf0","payload_size":468,"payload_type":"application/json","message_type":"com.twilio.rtd.cds.map","notification_ctx_id":""}
    {"event_type":"map_item_removed","event_protocol_version":3,"event":{"item_revision":"7","map_unique_name":"655673577604907008.channels","date_created":"2019-11-15T10:51:13.757Z","item_key":"CH1a8c965f2cf94102a90ce2738a4f5598","map_revision":"8","id":7,"map_sid":"MPba3eb0b3eba84190b67952c7bfd04b08","item_data":{"notificationLevel":"default","channelUrl":null,"lastConsumedMessageIndex":null,"channel":"CH1a8c965f2cf94102a90ce2738a4f5598.channel","status":"joined"}}}
      4 | Twilsock.Client | onMessageReceived, method = 4, id = TMbd8b71c100134d14b8f5abf1a4196cf0
      4 | Twilsock.Client | processNotificationMessage in state Connected, TMbd8b71c100134d14b8f5abf1a4196cf0
     22 | NotificationMgr | ReceivedTargetedNotification type='twilsock', messageType='com.twilio.rtd.cds.map'
      4 | Twilsock.Client | sendSuccessReplyImpl in state Connected
      5 | Twilsock.ClientImpl | sendSuccessReply: TMbd8b71c100134d14b8f5abf1a4196cf0, 
      5 | Twilsock.ClientImpl | sendSuccessReply, id = TMbd8b71c100134d14b8f5abf1a4196cf0
 Notification queue worker | Dequeued one notification
 Notification queue worker | workerRoute 'com.twilio.rtd.cds.map', channel: twilsock
     19 | WebsocketSession | Doing read
        | Router | Message with type 'com.twilio.rtd.cds.map, from channel: twilsock' is being routed to 1 targets
 Websocket | Sending frame via websocket (116 bytes)
    TWILSOCK V3.0 96
    {"id":"TMbd8b71c100134d14b8f5abf1a4196cf0","method":"reply","status":{"code":200,"status":"ok"}}
| IPM | user channels: item {CH1a8c965f2cf94102a90ce2738a4f5598} removed MPba3eb0b3eba84190b67952c7bfd04b08
| IPM | [zJ2VU] channel: initialize with status notParticipating
| IPM | [zJ2VU] channel: StateChannelCollections->StateChannelDocument
| IPM | [zJ2VU] messages: unsubscribing from data updates
|     62 | SyncList | unsubscribe
|     24 | TSSubscriptions | Removing subscription for ESf2a5d06ef5894aa2b4a332e1c29d86b0
| Retrier | Starting retryable operation
| Retrier | nextDelay count 0
| Retrier | nextDelay(initial) 100
| Retrier | actual delay 91
|      4 | Twilsock.Client | onMessageReceived (476)
    TWILSOCK V3.0 190
    {"method":"notification","id":"TMb7e4bd0988d248c8b2bfd155c6e48812","payload_size":263,"payload_type":"application/json","message_type":"com.twilio.rtd.cds.document","notification_ctx_id":""}
    {"event_type":"document_removed","event_protocol_version":3,"event":{"document_unique_name":"CH1a8c965f2cf94102a90ce2738a4f5598.channel","date_created":"2019-11-13T10:25:23.340Z","document_revision":"1","id":1,"document_sid":"ETbacb7bef3a0042eca8736f582bfb01bd"}}
| IPM | [zJ2VU] messages: StateMessagesInitialized->StateNotInitialized
| IPM | [zJ2VU] members: unsubscribing from data updates
|     60 | SyncMap | unsubscribe
|      4 | Twilsock.Client | onMessageReceived, method = 4, id = TMb7e4bd0988d248c8b2bfd155c6e48812
|     24 | TSSubscriptions | Removing subscription for MP27d1392409a043838df2faeaab2c7749
|      4 | Twilsock.Client | processNotificationMessage in state Connected, TMb7e4bd0988d248c8b2bfd155c6e48812
|     22 | NotificationMgr | ReceivedTargetedNotification type='twilsock', messageType='com.twilio.rtd.cds.document'
|     19 | WebsocketSession | Doing read
| IPM | [zJ2VU] members: StateMembersInitialized->StateNotInitialized
|      4 | Twilsock.Client | sendSuccessReplyImpl in state Connected
| Notification queue worker | Dequeued one notification
|      5 | Twilsock.ClientImpl | sendSuccessReply: TMb7e4bd0988d248c8b2bfd155c6e48812, 
| Notification queue worker | workerRoute 'com.twilio.rtd.cds.document', channel: twilsock
|      5 | Twilsock.ClientImpl | sendSuccessReply, id = TMb7e4bd0988d248c8b2bfd155c6e48812
|        | Router | Message with type 'com.twilio.rtd.cds.document, from channel: twilsock' is being routed to 1 targets
| Websocket | Sending frame via websocket (116 bytes)
    TWILSOCK V3.0 96
    {"id":"TMb7e4bd0988d248c8b2bfd155c6e48812","method":"reply","status":{"code":200,"status":"ok"}}
 I/TWC:        |     54 | SyncDocument | Notification arrived: document_removed
 I/TWC:        | IPM | document remotely deleted ETbacb7bef3a0042eca8736f582bfb01bd
 I/TWC:        | IPM | [listener] on channel deleted CH1a8c965f2cf94102a90ce2738a4f5598 3
 D/TWC:        | IPM | [zJ2VU] removing channel from cache CH1a8c965f2cf94102a90ce2738a4f5598
 D/TWC:        | ChatClientListener(native) | onChannelDeleted
 D/TWC:        | EntityCache | Returning Java object from cache
 D/ChatClientListenerForwarder: onChannelDeleted sid|CH1a8c965f2cf94102a90ce2738a4f5598| 49556788
 I/TWC:        | IPM | [zJ2VU] channel: [api] get uniquename ()
 E/ChatClientManager:  On Channel deleted---uniqueName----
 I/TWC:        | IPM | [zJ2VU] channel: [api] get friendlyname (Qawertyy)
 E/ChatClientManager:  On Channel deleted---friendlyName----Qawertyy
 E/ChatClientManager:  On Channel deleted---sid----CH1a8c965f2cf94102a90ce2738a4f5598
 E/ChatClientManager:  On Channel deleted---type----PRIVATE
 I/TWC:        | IPM | [zJ2VU] channel: [api] get uniquename ()
 D/ChatClientManager: Channel Id ==========
 I/TWC:        | IPM | [zJ2VU] channel: [api] get friendlyname (Qawertyy)
 D/ChatClientManager: Channel friendlyName ==========Qawertyy
 I/TWC:        |  | [zJ2VU] channel: [api] get uniquename ()
 V/TWC:        |      4 | Twilsock.Client | onMessageReceived (450)
    TWILSOCK V3.0 185
    {"method":"notification","id":"TM7d1f846952f14572b5e2c40c7d888aa2","payload_size":242,"payload_type":"application/json","message_type":"com.twilio.rtd.cds.map","notification_ctx_id":""}
    {"event_type":"map_removed","event_protocol_version":3,"event":{"map_unique_name":"CH1a8c965f2cf94102a90ce2738a4f5598.roster","date_created":"2019-11-15T10:49:36.838Z","map_revision":"4","id":3,"map_sid":"MP27d1392409a043838df2faeaab2c7749"}}
      4 | Twilsock.Client | onMessageReceived, method = 4, id = TM7d1f846952f14572b5e2c40c7d888aa2
      4 | Twilsock.Client | processNotificationMessage in state Connected, TM7d1f846952f14572b5e2c40c7d888aa2
      4 | Twilsock.Client | sendSuccessReplyImpl in state Connected
      5 | Twilsock.ClientImpl | sendSuccessReply: TM7d1f846952f14572b5e2c40c7d888aa2, 
      5 | Twilsock.ClientImpl | sendSuccessReply, id = TM7d1f846952f14572b5e2c40c7d888aa2
 Websocket | Sending frame via websocket (116 bytes)
    TWILSOCK V3.0 96
    {"id":"TM7d1f846952f14572b5e2c40c7d888aa2","method":"reply","status":{"code":200,"status":"ok"}}
 |     22 | NotificationMgr | ReceivedTargetedNotification type='twilsock', messageType='com.twilio.rtd.cds.map'
 |     19 | WebsocketSession | Doing read
 | Notification queue worker | Dequeued one notification
 | Notification queue worker | workerRoute 'com.twilio.rtd.cds.map', channel: twilsock
 |        | Router | Message with type 'com.twilio.rtd.cds.map, from channel: twilsock' is being routed to 1 targets
 |     24 | TSSubscriptions | Found no subscriber for map_removed MP27d1392409a043838df2faeaab2c7749
 |      4 | Twilsock.Client | onMessageReceived (457)
    TWILSOCK V3.0 186
    {"method":"notification","id":"TM523b81762f744a108811e1504d840b45","payload_size":248,"payload_type":"application/json","message_type":"com.twilio.rtd.cds.list","notification_ctx_id":""}
    {"event_type":"list_removed","event_protocol_version":3,"event":{"date_created":"2019-11-13T10:25:23.195Z","list_sid":"ESf2a5d06ef5894aa2b4a332e1c29d86b0","list_unique_name":"CH1a8c965f2cf94102a90ce2738a4f5598.messages","id":0,"list_revision":"1"}}
     4 | Twilsock.Client | onMessageReceived, method = 4, id = TM523b81762f744a108811e1504d840b45
     4 | Twilsock.Client | processNotificationMessage in state Connected, TM523b81762f744a108811e1504d840b45
    22 | NotificationMgr | ReceivedTargetedNotification type='twilsock', messageType='com.twilio.rtd.cds.list'
    19 | WebsocketSession | Doing read
     4 | Twilsock.Client | sendSuccessReplyImpl in state Connected
     5 | Twilsock.ClientImpl | sendSuccessReply: TM523b81762f744a108811e1504d840b45, 
     5 | Twilsock.ClientImpl | sendSuccessReply, id = TM523b81762f744a108811e1504d840b45
Websocket | Sending frame via websocket (116 bytes)
    TWILSOCK V3.0 96
    {"id":"TM523b81762f744a108811e1504d840b45","method":"reply","status":{"code":200,"status":"ok"}}
 Notification queue worker | Dequeued one notification
 Notification queue worker | workerRoute 'com.twilio.rtd.cds.list', channel: twilsock
        | Router | Message with type 'com.twilio.rtd.cds.list, from channel: twilsock' is being routed to 1 targets
     24 | TSSubscriptions | Found no subscriber for list_removed ESf2a5d06ef5894aa2b4a332e1c29d86b0
 TSSubscriptions | retryOperation 91, error system:0
 TSSubscriptions | retryOperation call retrierAttempt
     24 | TSSubscriptions | retrierAttempt
     24 | TSSubscriptions | subscriptions to remove: 2
     24 | TSSubscriptions | Sending 2 subscription request(s) for action: cancel, correlationId: 17673713
      4 | Twilsock.Client | sendMessageImpl in state Connected, RQ6234a269dab64688b877a505d4645b58
      5 | Twilsock.ClientImpl | sendUpstreamMessage
      5 | Twilsock.ClientImpl | sendUpstreamMessage, id = RQ6234a269dab64688b877a505d4645b58 - with observer
 Message::encode | Payload size 265
 Message::encode | Read Payload to string {"action":"cancel","correlation_id":17673713,"event_protocol_version":3,"requests":[{"object_sid":"MP27d1392409a043838df2faeaab2c7749","object_type":"map"},{"object_sid":"ESf2a5d06ef5894aa2b4a332e1c29d86b0","object_type":"list"}],"retried_requests":0,"ttl_in_s":-1}
      4 | Twilsock.Client | sendHttpMessage RQ6234a269dab64688b877a505d4645b58
      4 | Twilsock.Client | requestId=RQ6234a269dab64688b877a505d4645b58, Host: cds.us1.twilio.com, path: /v4/Subscriptions
 Websocket | Sending frame via websocket (803 bytes)
    TWILSOCK V3.0 515
    {"active_grant":"ip_messaging","http_request":{"headers":{"Content-Type":"application/json; charset=utf-8","Twilio-Request-Id":"RQ0b92df01a28c4143a46d206c843643e0","Twilio-Sync-Client-Info":"{\"os\":\"Linux\",\"osVer\":\"3.18.137-g72a7a64494e\",\"pl\":\"aarch64\",\"plVer\":\"\",\"sdk\":\"cpp\",\"sdkVer\":\"\"}"},"host":"cds.us1.twilio.com","method":"POST","path":"/v4/Subscriptions"},"id":"RQ6234a269dab64688b877a505d4645b58","method":"message","payload_size":265,"payload_type":"application/json; charset=utf-8"}
    {"action":"cancel","correlation_id":17673713,"event_protocol_version":3,"requests":[{"object_sid":"MP27d1392409a043838df2faeaab2c7749","object_type":"map"},{"object_sid":"ESf2a5d06ef5894aa2b4a332e1c29d86b0","object_type":"list"}],"retried_requests":0,"ttl_in_s":-1}
  V/TWC:       |      4 | Twilsock.Client | onMessageReceived (575)
    TWILSOCK V3.0 479
    {"method":"reply","id":"RQ6234a269dab64688b877a505d4645b58","payload_size":73,"payload_type":"application/json;charset=utf-8","status":{"code":200,"status":"OK"},"http_headers":{"Server":"nginx","Date":"Fri, 15 Nov 2019 10:51:14 GMT","Content-Type":"application/json;charset=utf-8","Content-Length":"73","Twilio-Request-Id":"RQ0b92df01a28c4143a46d206c843643e0","X-Shenanigans":"none","Strict-Transport-Security":"max-age=31536000"},"http_status":{"code":202,"status":"Accepted"}}
    {"estimated_delivery_in_ms":10000,"max_batch_size":1000,"ttl_in_s":86400}
    4 | Twilsock.Client | onMessageReceived, method = 8, id = RQ6234a269dab64688b877a505d4645b58
    4 | Twilsock.Client | processReplyMessage in state Connected, RQ6234a269dab64688b877a505d4645b58
   19 | WebsocketSession | Doing read
    4 | Twilsock.Client | Reply for 'RQ6234a269dab64688b877a505d4645b58', code=200
    4 | Twilsock.Client | receivedSuccessMessageReply in state Connected
   83 | Twilsock.Observer | onSuccess()
    4 | Twilsock.Client | onMessageReceived (374)
    TWILSOCK V3.0 180
    {"method":"notification","id":"TMaec27a891ae947319b754053e49d9741","payload_size":171,"payload_type":"application/json","message_type":"twilio.sync.event","notification_ctx_id":""}
    {"event_type":"subscription_canceled","correlation_id":17673713,"event_protocol_version":3,"event":{"object_sid":"MP27d1392409a043838df2faeaab2c7749","object_type":"map"}}
 | HttpResponse.ctor | payload '{"estimated_delivery_in_ms":10000,"max_batch_size":1000,"ttl_in_s":86400}'
 |     24 | TSSubscriptions | Handling response from subscription server for action cancel (correlationId: 17673713, response: {"estimated_delivery_in_ms":10000,"max_batch_size":1000,"ttl_in_s":86400})
 |      4 | Twilsock.Client | onMessageReceived, method = 4, id = TMaec27a891ae947319b754053e49d9741
 |      4 | Twilsock.Client | processNotificationMessage in state Connected, TMaec27a891ae947319b754053e49d9741
 |     24 | TSSubscriptions | cancelRetrier
 |     24 | TSSubscriptions | retrierSucceeded
 |     22 | NotificationMgr | ReceivedTargetedNotification type='twilsock', messageType='twilio.sync.event'
 |     19 | WebsocketSession | Doing read
 |      4 | Twilsock.Client | sendSuccessReplyImpl in state Connected
 | Notification queue worker | Dequeued one notification
 |      5 | Twilsock.ClientImpl | sendSuccessReply: TMaec27a891ae947319b754053e49d9741, 
 | Notification queue worker | workerRoute 'twilio.sync.event', channel: twilsock
 |      5 | Twilsock.ClientImpl | sendSuccessReply, id = TMaec27a891ae947319b754053e49d9741
 |        | Router | Message with type 'twilio.sync.event, from channel: twilsock' is being routed to 1 targets
 |     24 | TSSubscriptions | applySubscriptionMessage: messageType: subscription_canceled, sid: MP27d1392409a043838df2faeaab2c7749, correlationId: 17673713
 | Websocket | Sending frame via websocket (116 bytes)
    TWILSOCK V3.0 96
    {"id":"TMaec27a891ae947319b754053e49d9741","method":"reply","status":{"code":200,"status":"ok"}}
        Retrier | Starting retryable operation
        Retrier | nextDelay count 0
        Retrier | nextDelay(initial) 100
        Retrier | actual delay 106
             4 | Twilsock.Client | onMessageReceived (375)
    TWILSOCK V3.0 180
    {"method":"notification","id":"TM11d8f6876c034ba197aca63e28c20317","payload_size":172,"payload_type":"application/json","message_type":"twilio.sync.event","notification_ctx_id":""}
    {"event_type":"subscription_canceled","correlation_id":17673713,"event_protocol_version":3,"event":{"object_sid":"ESf2a5d06ef5894aa2b4a332e1c29d86b0","object_type":"list"}}
            4 | Twilsock.Client | onMessageReceived, method = 4, id = TM11d8f6876c034ba197aca63e28c20317
            4 | Twilsock.Client | processNotificationMessage in state Connected, TM11d8f6876c034ba197aca63e28c20317
           22 | NotificationMgr | ReceivedTargetedNotification type='twilsock', messageType='twilio.sync.event'
           19 | WebsocketSession | Doing read
            4 | Twilsock.Client | sendSuccessReplyImpl in state Connected
            5 | Twilsock.ClientImpl | sendSuccessReply: TM11d8f6876c034ba197aca63e28c20317, 
            5 | Twilsock.ClientImpl | sendSuccessReply, id = TM11d8f6876c034ba197aca63e28c20317
       Websocket | Sending frame via websocket (116 bytes)
    TWILSOCK V3.0 96
    {"id":"TM11d8f6876c034ba197aca63e28c20317","method":"reply","status":{"code":200,"status":"ok"}}
      Notification queue worker | Dequeued one notification
      Notification queue worker | workerRoute 'twilio.sync.event', channel: twilsock
             | Router | Message with type 'twilio.sync.event, from channel: twilsock' is being routed to 1 targets
          24 | TSSubscriptions | applySubscriptionMessage: messageType: subscription_canceled, sid: ESf2a5d06ef5894aa2b4a332e1c29d86b0, correlationId: 17673713
      TSSubscriptions | retryOperation 106, error system:0
      TSSubscriptions | retryOperation call retrierAttempt
          24 | TSSubscriptions | retrierAttempt
          24 | TSSubscriptions | cancelRetrier
          24 | TSSubscriptions | retrierSucceeded

Or attach it as a file.

Versions

Chat Android SDK

twilio_chat_version = '4.2.5'

minSdkVersion 21 targetSdkVersion 29

Android Device

Pixel Samsung-M405F Nexus Moto G5s plus One Plus 6

As I understand all activities are fine. If you need more information please let me know.

berkus commented 5 years ago

Hi

Thanks for the well detailed report.

I believe this bug is known and we're planning to release a fix for it. I will keep this one open until we release a fix publicly.

ajitdubey-mob-ibtech commented 5 years ago

@berkus Thanks for the update

berkus commented 3 years ago

This behavior is fixed in Twilio Conversations, Chat code is kept with the old behavior due to compatibility concerns.