Yes, threaded messaging with PubNub is possible. If you're using PubNub's Chat SDK, it includes a built-in threading feature that simplifies the implementation of threaded conversations.
While for other SDKs an out-of-the-box solution for threaded messaging isn't available, you can achieve this by using message metadata.
A good approach is to create a hierarchy between messages by tagging them with metadata of your choice and managing their relationships on your end. For example, you can use the time token of the original message sent on a channel as a threading key. This allows you to group all related messages and ensure their correct ordering in your UI by leveraging each message's time token.