Client Alias

An alias is an optional string that identifies a client (for example a user id or device name). It is not a separate authentication method.

How to set it

SDK constructor

const socket = new QPub.Socket({
  apiKey: process.env.QPUB_API_KEY,
  alias: "user-42",
});

Token claims

await rest.auth.issueToken({ alias: "user-42" });

REST header / Socket query

  • REST: X-Alias: user-42
  • WebSocket: &alias=user-42

Where it appears

  • Connection metadata in the platform
  • Optional alias on published messages (you can also set alias per publish)
await channel.publish({ text: "hi" }, { alias: "user-42", event: "chat" });

Guidance

  • Use stable, non-secret identifiers (user id, session id).
  • Do not put secrets in the alias.
  • Combine with scoped tokens so each client only has the channels it needs.