# @enonic-types/lib-websocket

> Type definitions for lib-websocket.

Latest version **8.0.4** (published 2026-08-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @enonic-types/lib-websocket
pnpm add @enonic-types/lib-websocket
yarn add @enonic-types/lib-websocket
bun add @enonic-types/lib-websocket
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 8.0.4 |
| Published | 2026-08-12 |
| First published | 2022-07-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 211 |
| Maintainers | alansemenov, edloidas |
| Keywords | enonic, enonic-xp, lib-websocket, websocket, types, typescript |

## Links

- npm: https://www.npmjs.com/package/@enonic-types/lib-websocket
- Repository: https://github.com/enonic/xp.git#master
- Homepage: https://github.com/enonic/xp/tree/master#readme
- Issues: https://github.com/enonic/xp/issues
- npm.io page: https://npm.io/package/@enonic-types/lib-websocket

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 8.0.4 (latest) — 2026-08-12
- 8.1.0-RC1 (beta) — 2026-09-09
- 8.1.0-B3 — 2026-09-07
- 8.1.0-B2 — 2026-09-02
- 8.1.0-B1 — 2026-08-27
- 7.16.8 — 2026-08-11
- 8.0.4-B2 — 2026-08-07
- 7.16.8-B1 — 2026-08-06
- 7.16.7 — 2026-07-10
- 8.0.4-B1 — 2026-07-09
- 7.16.7-RC1 — 2026-07-07
- 8.0.3 — 2026-07-02
- 7.16.6 — 2026-07-02
- 7.16.5 — 2026-06-12
- 8.0.2 — 2026-06-12
- … 75 more at https://npm.io/package/@enonic-types/lib-websocket/versions

## README

# Enonic XP lib-websocket TS types

> TypeScript definitions for `lib-websocket` library of Enonic XP

## Install

```bash
npm i --save-dev @enonic-types/lib-websocket
```

## Use

### Require and custom imports

To make `require` work out of the box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default path will return typed object.

`tsconfig.json`

```json
{
  "compilerOptions": {
    "types": [
      "@enonic-types/global"
    ]
  }
}
```

`example.ts`

```ts
const {addToGroup, removeFromGroup, send, sendToGroup, getGroupSize} = require('/lib/xp/websocket');
```

More detailed explanation on how it works and how to type custom import function can be
found [here](https://developer.enonic.com/docs/xp/stable/api).

### ES6-style import

If you are planning to use `import` in your code and transpile it with the default `tsc` TypeScript compiler, you'll need to add proper
types mapping to your configuration.

`tsconfig.json`

```json
{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "/lib/xp/websocket": ["node_modules/@enonic-types/lib-websocket"]
    }
  }
}
```

`example.ts`

```ts
import {addToGroup, removeFromGroup, send, sendToGroup, getGroupSize} from '/lib/xp/websocket';
```

Setting `baseUrl` and `paths` will allow the `tsc` to keep the valid paths in the resulting JavaScript files.

---
_Source: https://npm.io/package/@enonic-types/lib-websocket · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
