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

4

1 回答 1

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.

于 2016-11-01T12:34:48.390 回答