Registry / devops / atmosphere.js

atmosphere.js

JSON →
library5.0.29jsnpmunverified

Modern TypeScript client for the Atmosphere Framework, providing real-time communication via WebSocket, SSE, Long-Polling, Streaming, and WebTransport transports. Version 5.0.29 is the latest stable release. It is actively maintained with frequent updates. Key differentiators include full TypeScript type safety, tree-shakeable imports, optional React/Vue/Svelte integrations as peer dependencies, and automatic reconnection with exponential backoff. Compared to bare WebSocket, it offers transport fallback and protocol abstraction.

npm install atmosphere.js
INSTALL
IMPORT
SIG · ATMOSPHERE.JS
A
atmosphere.js
devopsjavascriptv5.0.29
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

atmosphere
✓ import { atmosphere } from 'atmosphere.js'
✗ const atmosphere = require('atmosphere.js')
Default instance, pre-configured. ESM-only since v5.0.0.
Atmosphere
✓ import { Atmosphere } from 'atmosphere.js'
✗ import Atmosphere from 'atmosphere.js'
Named class for creating custom instances. No default export.
AtmosphereRequest
✓ import type { AtmosphereRequest } from 'atmosphere.js'
✗ import { AtmosphereRequest } from 'atmosphere.js'
Type import for request options. Use 'import type' to avoid runtime overhead.

Creates a WebSocket subscription, sends a JSON message, and closes the connection.

import { atmosphere } from 'atmosphere.js'; const subscription = await atmosphere.subscribe({ url: process.env.SERVER_URL ?? 'http://localhost:8080/chat', transport: 'websocket', }, { message: (response) => { console.log('Received:', response.responseBody); }, open: (response) => { console.log('Connected with transport:', response.transport); }, close: (response) => { console.log('Connection closed'); }, error: (error) => { console.error('Error:', error); } }); subscription.push({ user: 'John', message: 'Hello World' }); await subscription.close();
Debug
Known issues
breakingIn v4, `atmosphere.subscribe()` returned a promise but had different callback signatures.
fix
Upgrade to v5 and adjust callbacks to match new signature.
affects: >=4.0.0 <5.0.0
breakingESM-only since v5 — CJS `require()` no longer works.
fix
Use `import { atmosphere } from 'atmosphere.js'` or switch to dynamic import().
affects: >=5.0.0
deprecatedThe `enableProtocol` option is deprecated and will be removed in v6.
fix
Avoid using `enableProtocol`; use default protocol handling.
affects: >=5.0.0
gotchaIn React Native, `@react-native-community/netinfo` must be installed as a peer dependency.
fix
Run `npm install @react-native-community/netinfo` for React Native projects.
affects: >=5.0.0
gotchaThe `transport` option is required; if omitted, the library may throw or default incorrectly.
fix
Always specify `transport` when calling `subscribe()`.
affects: >=5.0.0
Errors
Common errors & fixes
Error: Cannot find module 'atmosphere.js' or its corresponding type declarations.
ESM-only package imported with `require()` or missing TypeScript module resolution.
fix
Ensure `"type": "module"` in package.json or use `import { atmosphere } from 'atmosphere.js'`.
TypeError: atmosphere.subscribe is not a function
Imported default instead of named export `atmosphere`.
fix
Use `import { atmosphere } from 'atmosphere.js'` (named import).
Property 'push' does not exist on type 'Subscription'
Using an older version (<5.0.0) where `push` is not available or different name.
fix
Update to at least version 5.0.0.
ReactNative: NetInfo fetch error: undefined is not an object (evaluating 'NativeModules.RNCNetInfo.getCurrentState')
Missing `@react-native-community/netinfo` peer dependency.
fix
Install the package: `npm install @react-native-community/netinfo`.
Upgrade
Version history
5.0.29latest on npm
Audit
Dependencies
@react-native-community/netinfooptionalRequired for React Native connectivity detection
reactoptionalPeer dependency for React integration
react-nativeoptionalPeer dependency for React Native integration
svelteoptionalPeer dependency for Svelte integration
vueoptionalPeer dependency for Vue integration
Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
atmosphere.js — npm install atmosphere.js · libregistry