CometD is a scalable comet and WebSocket messaging library for web applications, providing publish/subscribe, RPC, and peer-to-peer communication patterns. The current stable version is 9.0.0, released under the Apache 2.0 license. It ships TypeScript types and supports ES modules. CometD replaces the older cometd-jQuery and provides a modern, promise-based API. It differentiates from alternatives like Socket.IO by being more lightweight and focusing on the Bayeux protocol with built-in support for long-polling, WebSocket, and extensions like time-stamping.
npm install cometdNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes a CometD client, registers a time-stamp extension, configures the URL, performs a handshake, and subscribes to a topic.
Ensure your runtime supports ES modules (Node >=13.2 or modern browser). Use import/export syntax.
Use the core CometD library without jQuery. Migrate any jQuery-specific extensions.
Switch to ES module imports: import { CometD } from 'cometd'.Use correct path like 'cometd/TimeStampExtension' not 'cometd/timestamp'.
Use named import: import { CometD } from 'cometd';Install package via npm install cometd and ensure using ES module syntax.
Configure server to serve .js files with MIME type application/javascript or text/javascript.
No dependency data recorded yet.