Join chat

Logux Headers

Logux’s headers are an API to set session data like selected language.

The client can define an object with any keys inside. We recommend doing it before connecting to the server.

  • store.client.node.setLocalHeaders({ locale: 'fr-FR' })
    store.client.start()

    During the session, you can change headers by calling this method again. If the next headers miss some keys from the previous call, these keys will be removed.

    Note, that you should manually synchronize headers changes between browser tabs.

    On the server, you can get the client’s headers during the authentication, action, or channel processing.

      process (ctx, action, meta) {
        ctx.sendBack({
          type: 'notification',
          message: I18N[ctx.locale || 'en-US'].success
        })
      }