1

We are using PubNub for Chatting, and we are trying to add Typing indicator when a user types. We are trying to send the presence in state-changed, using client.publish method in swift, with the presence channel, when I publish that, I don't receive any event in didReceivePresence callback. I also subscribedToPresenceChannels.

Can anybody clarify that, how isTyping indicator feature works with the PubNub? Do we need to use Presence (or) Separate Channel to maintain? If we need to do with a separate channel then please suggest how can I proceed further

Thank you

Umair Afzal
  • 4,947
  • 5
  • 25
  • 50
anjnkmr
  • 838
  • 15
  • 37

1 Answers1

1

publish API designed to work with regular channels and you can't use it to publish some message to presence channel. You get presence messages by subscribe to a channel shouldObservePresence parameter enabled.

You may only listen to presence channels and the PubNub service is the only publisher on the presences channels.

To change state you need to use client.setState API and pass typing:true state there for a particular channel and PubNub will create a state-change event on that client's behalf. All clients subscribed with presence enabled on that channel will receive the state-change event via the didReceivePresenceEvent listener.

Craig Conover
  • 4,710
  • 34
  • 59
Serhii Mamontov
  • 4,942
  • 22
  • 26
  • sorry for the delay i'll check and update you with results, thank you – anjnkmr Nov 29 '16 at 04:08
  • `didReceivePresenceEvent` firing some times (Most of the time it is not firing) when i'm setting state - `client?.setState` - and i also `subscirbe to channel with presence true` – anjnkmr Nov 29 '16 at 10:30
  • and i also checked that i'm setting status in same channel which i have subscribed in another device – anjnkmr Nov 29 '16 at 10:50
  • Need logs - repro with [PN logging enabled](https://www.pubnub.com/docs/swift/pubnub-swift-sdk-troubleshooting-guide) and upload them somewhere or send to [PubNub support](http://pubnub.com/support) – Craig Conover Nov 29 '16 at 15:40
  • @Serhii Mamontov can you check this question please? https://stackoverflow.com/questions/44945992/pubnub-istyping-status-ionic2 – StuartDTO Jul 07 '17 at 09:58
  • @CraigConover also you please – StuartDTO Jul 07 '17 at 10:00