PubNub JavaScript APIs

Storage and Playback (History API)

Storage and Playback In a Nutshell

PubNub's Storage and Playback feature, also referred as History API, enables you to store messages temporary as they are published, and retrieve the previously-published messages at a later time. (API)

Demo

See the previous section to see How to Play Tic-Tac-Toe.

You (X):

  1. Stay on this browser
  2. Play when your opponent is ready

Your opponent (O) should be playing from this URL:

To demonstrate how PubNub Storage and Playback (History API) works, each move is recorded by sending the data to PubNub data stream with timestamp. You will see how the API works after the game!

Game ID:
You:
It is your turn!

History API Explained

This game has maximum 9 moves. Each move data is sent to PubNub, so that you can track back 9 messages using History API. Let's see how the API with these optional attributes works:

History count:

Reverse the traversal order
True will return messages in first-in-first-out (FIFO) order. This is disregarded, when the time is specified.

Specific Time span