Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
crossbar 25.12.1
Logo
Light Logo Dark Logo
  • Introduction
  • Installation
  • Reproducible Builds with uv.lock
  • Getting Started
  • What is WAMP?
  • Introduction
  • WAMP Clients
  • Prerequisite
  • What’s in this guide
  • Basic Concept:
  • Node Controller:
  • Router:
  • Installing Docker
  • Example Code
  • Starting a Crossbar.io Router
  • Crossbar configuration
  • Hello World
  • NodeJS Example
  • RPC Example
  • Modifying Things
  • Further Materials
  • Programming Guide
    • Starting and Stopping Crossbar.io
    • Startup and Shutdown Behavior
    • Configuring Crossbar.io Logging
    • URI Format
    • Logging in Crossbar.io
    • Error Handling
    • Session Meta Events and Procedures
    • Session Statistics
    • Development with External Devices
    • How Subscriptions Work
    • Next
    • Basic Subscriptions
    • Subscriber Black- and Whitelisting
    • Publisher Exclusion
    • Publisher Identification
    • Pattern Based Subscriptions
    • Subscription Meta Events and Procedures
    • Event History
    • Retained Events
    • Retrieving an Event
    • Example
    • How Registrations Work
    • Basic Registrations
    • Caller Identification
    • Progressive Call Results
    • Pattern-Based Registrations
    • Shared Registrations
    • Registration Meta-Events and Procedures
    • End-to-end Encryption
    • cryptobox
    • Cryptobox Payload Encryption
    • Adding Real-Time to Django Applications
    • First steps
    • The HTML
    • Client monitoring
    • Crossbar.io
    • AngularJS Application Components
    • Minimal Example
    • Database Programming with PostgreSQL
    • Frameworks
    • Libraries
    • UI frameworks
  • Administration Guide
    • Basic Concepts
    • Node Configuration
    • IoT Microservice Weather Balloon example using Container Component with Dynamic Authentication
    • Processes
    • Controller Configuration
    • Router Configuration
    • Router Realms
    • Router Components
    • Proxy-Workers
    • Container Configuration
    • Guest Configuration
    • Native Worker Options
    • Process Environments
    • Router Transports
    • Transport Endpoints
    • WebSocket Transport
    • WebSocket Options
    • WebSocket Compression
    • RawSocket Transport
    • Flash Policy Transport
    • Web Transport and Services
    • Web Services
    • Static Web Service
    • Web Redirection Service
    • JSON Value Service
    • Node Info Service
    • CGI Script Service
    • WSGI Host Service
    • Reverse Proxy Service
    • WebSocket Service
    • Long-poll Service
    • Path Service
    • Resource Service
    • File Upload Service
    • Web Archives
    • HTTP Bridge
    • HTTP Bridge Publisher
    • HTTP Bridge Subscriber
    • HTTP Bridge Caller
    • HTTP Bridge Callee
    • HTTP Bridge Webhook
    • Authentication
    • Anonymous Authentication
    • Ticket Authentication
    • Challenge-Response Authentication
    • SCRAM Authentication
    • Cryptosign Authentication
    • Cookie Authentication
    • TLS Client Certificate authentication
    • Dynamic Authenticators
    • Authorization
    • Secure WebSocket and HTTPS
    • TLS Certificates
    • Updating Certificates
    • SSL/TLS Interception Proxies
    • Cookie Tracking
    • MQTT Broker and Bridge
    • The Command Line
    • Logging
    • Going to Production
    • Automatic Startup and Restart
    • Running on Privileged Ports
    • Scaling Crossbar.io
    • Network Tuning
    • Reverse Proxies
    • Installation on Linux
    • Installation on Mac OS X
    • Installation on Windows
    • Creating Docker Images
    • Setup on Amazon EC2
    • Setup on Heroku
    • Setup on OpenShift
  • Release Notes
  • Changelog
  • Contributing
  • WAMP Projects Overview
  • AI Policy
    • AI Contributors Policy
    • AI Assistants Policy
    • Disclosure of Use of AI Assistance
    • AI-Assisted Work Audit Log
    • AI Disclosure Process
    • AI Audit Process Review
  • API Reference
    • crossbar
      • crossbar._compat
      • crossbar._log_categories
      • crossbar._logging
      • crossbar._util
      • crossbar.bridge
        • crossbar.bridge.mqtt
          • crossbar.bridge.mqtt._events
          • crossbar.bridge.mqtt._utils
          • crossbar.bridge.mqtt.protocol
          • crossbar.bridge.mqtt.tx
          • crossbar.bridge.mqtt.wamp
        • crossbar.bridge.rest
          • crossbar.bridge.rest.callee
          • crossbar.bridge.rest.caller
          • crossbar.bridge.rest.common
          • crossbar.bridge.rest.publisher
          • crossbar.bridge.rest.subscriber
          • crossbar.bridge.rest.webhook
      • crossbar.common
        • crossbar.common.checkconfig
        • crossbar.common.fswatcher
        • crossbar.common.key
        • crossbar.common.monitor
        • crossbar.common.process
        • crossbar.common.processinfo
        • crossbar.common.profiler
        • crossbar.common.reloader
        • crossbar.common.twisted
          • crossbar.common.twisted.endpoint
          • crossbar.common.twisted.processutil
          • crossbar.common.twisted.sharedport
          • crossbar.common.twisted.tlsctx
          • crossbar.common.twisted.web
      • crossbar.edge
        • crossbar.edge.node
          • crossbar.edge.node.docker
          • crossbar.edge.node.management
          • crossbar.edge.node.node
        • crossbar.edge.personality
        • crossbar.edge.webservice
          • crossbar.edge.webservice.pairme
        • crossbar.edge.worker
          • crossbar.edge.worker.auth
          • crossbar.edge.worker.hostmonitor
          • crossbar.edge.worker.monitor
            • crossbar.edge.worker.monitor._base
            • crossbar.edge.worker.monitor._cpu
            • crossbar.edge.worker.monitor._disk
            • crossbar.edge.worker.monitor._hardware
            • crossbar.edge.worker.monitor._memory
            • crossbar.edge.worker.monitor._network
            • crossbar.edge.worker.monitor._process
            • crossbar.edge.worker.monitor._self
            • crossbar.edge.worker.monitor._storage
            • crossbar.edge.worker.monitor._system
          • crossbar.edge.worker.postgresql
          • crossbar.edge.worker.realmstore
          • crossbar.edge.worker.router
          • crossbar.edge.worker.tracing
          • crossbar.edge.worker.xbr
            • crossbar.edge.worker.xbr._authenticator
            • crossbar.edge.worker.xbr._marketmaker
            • crossbar.edge.worker.xbr._util
          • crossbar.edge.worker.xbrmm
      • crossbar.functest_helpers
        • crossbar.functest_helpers.auth
      • crossbar.interfaces
      • crossbar.master
        • crossbar.master.api
          • crossbar.master.api.container
          • crossbar.master.api.docker
          • crossbar.master.api.nativeprocess
          • crossbar.master.api.node
          • crossbar.master.api.proxy
          • crossbar.master.api.remote
          • crossbar.master.api.router
          • crossbar.master.api.tracing
          • crossbar.master.api.wamp
          • crossbar.master.api.worker
        • crossbar.master.arealm
          • crossbar.master.arealm.arealm
        • crossbar.master.cluster
          • crossbar.master.cluster.routercluster
          • crossbar.master.cluster.webcluster
        • crossbar.master.mrealm
          • crossbar.master.mrealm.controller
          • crossbar.master.mrealm.liveview
          • crossbar.master.mrealm.metadata
          • crossbar.master.mrealm.mrealm
        • crossbar.master.node
          • crossbar.master.node.authenticator
          • crossbar.master.node.controller
          • crossbar.master.node.messenger
          • crossbar.master.node.node
          • crossbar.master.node.roles
          • crossbar.master.node.user
        • crossbar.master.personality
        • crossbar.master.webservice
          • crossbar.master.webservice.registerme
        • crossbar.master.xbr
          • crossbar.master.xbr._marketplace
      • crossbar.network
        • crossbar.network._api
        • crossbar.network._authenticator
        • crossbar.network._backend
        • crossbar.network._error
        • crossbar.network._mailgw
        • crossbar.network._util
        • crossbar.network._web
        • crossbar.network.node
          • crossbar.network.node.node
        • crossbar.network.personality
      • crossbar.node
        • crossbar.node.controller
        • crossbar.node.guest
        • crossbar.node.main
        • crossbar.node.native
        • crossbar.node.node
        • crossbar.node.template
        • crossbar.node.worker
      • crossbar.personality
      • crossbar.quickstart
        • crossbar.quickstart.main
        • crossbar.quickstart.quickstartvenv
      • crossbar.router
        • crossbar.router.auth
          • crossbar.router.auth.anonymous
          • crossbar.router.auth.cryptosign
          • crossbar.router.auth.pending
          • crossbar.router.auth.scram
          • crossbar.router.auth.ticket
          • crossbar.router.auth.tls
          • crossbar.router.auth.wampcra
        • crossbar.router.broker
        • crossbar.router.cookiestore
        • crossbar.router.dealer
        • crossbar.router.inventory
        • crossbar.router.longpoll
        • crossbar.router.observation
        • crossbar.router.protocol
        • crossbar.router.realmstore
        • crossbar.router.role
        • crossbar.router.router
        • crossbar.router.service
        • crossbar.router.session
        • crossbar.router.unisocket
        • crossbar.router.wildcard
      • crossbar.shell
        • crossbar.shell.app
        • crossbar.shell.client
        • crossbar.shell.command
        • crossbar.shell.config
        • crossbar.shell.idl
          • crossbar.shell.idl.generator
          • crossbar.shell.idl.loader
        • crossbar.shell.main
        • crossbar.shell.monitor
        • crossbar.shell.reflection
          • crossbar.shell.reflection.BaseType
          • crossbar.shell.reflection.Enum
          • crossbar.shell.reflection.EnumVal
          • crossbar.shell.reflection.Field
          • crossbar.shell.reflection.KeyValue
          • crossbar.shell.reflection.Object
          • crossbar.shell.reflection.RPCCall
          • crossbar.shell.reflection.Schema
          • crossbar.shell.reflection.Service
          • crossbar.shell.reflection.Type
        • crossbar.shell.repl
        • crossbar.shell.util
      • crossbar.webservice
        • crossbar.webservice.archive
        • crossbar.webservice.base
        • crossbar.webservice.catalog
        • crossbar.webservice.flashpolicy
        • crossbar.webservice.longpoll
        • crossbar.webservice.misc
        • crossbar.webservice.rest
        • crossbar.webservice.static
        • crossbar.webservice.wap
        • crossbar.webservice.websocket
        • crossbar.webservice.wsgi
      • crossbar.worker
        • crossbar.worker.container
        • crossbar.worker.controller
        • crossbar.worker.main
        • crossbar.worker.proxy
        • crossbar.worker.rlink
        • crossbar.worker.router
        • crossbar.worker.sample
          • crossbar.worker.sample._logging
        • crossbar.worker.testee
        • crossbar.worker.transport
        • crossbar.worker.types
Back to top
View this page
Edit this page

Cookie Tracking¶

Cookie tracking identifies and tracks WAMP-over-WebSocket client connections using HTTP cookies.

Cookie tracking can be enabled on WebSocket-Transport and Web-Transport Services . It is not available on other transport types such as RawSocket.

While enabling cookie tracking is a prerequisite for cookie-based WAMP authentication, it can be used without authentication.

How it works¶

Cookie tracking is backed by a configurable cookie store. Currently we have two types of store:

  • memory-backed

  • file-backed

    In the future, we’ll have an LMDB backed cookie store as well.

The stored information for a cookie includes the cookie ID as well as authentication information (see Cookie Authentication).

With a memory-backed cookie store, cookies are stored in in-memory objects, and, obviously, those cookies will be gone after stopping Crossbar.io

With a file-backed cookie store, cookies are stored in an append-only, on-disk file.

Cookie Tracking without Authentication¶

Cookie tracking can be enabled without using cookie-based authentication as well.

This is the case when

  1. no authentication is configured at all

  2. only anonymous authentication is configured

  3. only non-cookie based authentication is configured

With 1) and 2) and cookie tracking enabled, Crossbar.io will automatically use the cookie ID as the authentication ID (authid) for the client.

This way, you still can identify clients across reconnects using WAMP authid. Without cookies, in case of 1) and 2), a WAMP client will get a random authid each time it connects.

On the other hand, with 3), the authentication ID (authid) still comes from the respective authentication method used.

Cookie Tracking with Authentication¶

Please see Cookie Authentication.

Configuration¶

The following parameters are all optional and shared between different backing stores:

option

description

name

The field name where Crossbar.io will store its (random) tracking ID within the Cookie set. The default is “cbtid”. Must match the regular expression “^[a-z][a - z 0 - 9 _]+$” .

length

The length of the value for the tracking ID. The default is 24 (which amounts to 144 bits of randomness). The default should be large enough to reduce the collision probability to essentially zero. Must be between 6 and 64.

max_age

The maximum Cookie lifetime in seconds. The default is 1 day. Must be between 1 second and 10 years.

store

A dictionary with cookie store configuration (see below).

The store is a dictionary with the following attributes for a memory-backed cookie store:

attribute

description

type

Must be “memory”.

and for a file-backed cookie store:

attribute

description

type

Must be ”file” .

file name

Either an absolute path or a relative path (relative to the node directory)

Examples¶

To configure a memory-backed cookie store:

{
         "transports": [
            {
               "type": "web",
               "endpoint": {
                  "type": "tcp",
                  "port": 8080
               },
               "paths": {
                  "/": {
                     "type": "static",
                     "directory": "../web"
                  },
                  "ws": {
                     "type": "websocket",
                     "cookie": {
                        "name": "cbtid",
                        "length": 24,
                        "max_age": 864000,
                        "store": {
                           "type": "memory"
                        }
                     }
                  }
               }
            }
         ]
}

To configure a file-backed cookie store:

{
         "transports": [
            {
               "type": "web",
               "endpoint": {
                  "type": "tcp",
                  "port": 8080
               },
               "paths": {
                  "/": {
                     "type": "static",
                     "directory": "../web"
                  },
                  "ws": {
                     "type": "websocket",
                     "cookie": {
                        "name": "cbtid",
                        "length": 24,
                        "max_age": 864000,
                        "store": {
                           "type": "file",
                           "filename": "cookies.dat"
                        }
                     }
                  }
               }
            }
         ]
}

In above example, the cookie store would reside in .crossbar/cookies.dat for a default node directory.

Note that the cookie file is “growing forever”. There is no purging whatsoever, as the file is written append-only. The LMDB cookie store will provide a more advanced store.

Next
MQTT Broker and Bridge
Previous
SSL/TLS Interception Proxies
Copyright © 2013-2025, typedef int GmbH (Germany)
Made with Sphinx and @pradyunsg's Furo
On this page
  • Cookie Tracking
    • How it works
    • Cookie Tracking without Authentication
    • Cookie Tracking with Authentication
    • Configuration
    • Examples