What is the maximum length for a token string?

A token string takes two forms:

  • A literal token
    This is the most common type of token generated by Ably.  It contains a complete encrypted set of information for the token such as the client identifier and capabilities.  The maximum length for a literal token string is 343 bytes.
  • A persisted token 
    If a token is explicitly requested to be persisted, or the Ably system determines it should be persisted due to the complexity of capabilities for example. The maximum length for a persisted token string is 65 bytes.
Please note that we do not recommend, as part of your strategy, that a token is stored in a database.  A token is meant to be disposable and easy to be regenerated from an Ably TokenRequest or Ably JWT (JSON Web Token).  As such, we recommend if a token is needed, you generate a new token each time instead.