# socket.io-cookies-parser

> `Socket.IO Cookies Parser` help us handle cookie for Socket.IO[](https://socket.io/)

Latest version **1.1.1** (published 2021-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install socket.io-cookies-parser
pnpm add socket.io-cookies-parser
yarn add socket.io-cookies-parser
bun add socket.io-cookies-parser
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-06-14 |
| First published | 2021-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | nghia |
| Maintainers | nqnghia285 |
| Keywords | socket.io-cookies-parser, namespaceCookieParser, ioCookieParser |

## Links

- npm: https://www.npmjs.com/package/socket.io-cookies-parser
- Repository: https://github.com/nqnghia285/socket.io-cookies-parser
- Homepage: https://github.com/nqnghia285/socket.io-cookies-parser.git#readme
- npm.io page: https://npm.io/package/socket.io-cookies-parser

## Dependencies (5)

- [express](https://npm.io/package/express.md) ^4.17.1
- [socket.io](https://npm.io/package/socket.io.md) ^4.1.2
- [@types/node](https://npm.io/package/@types/node.md) ^14.14.37
- [handle-cookie](https://npm.io/package/handle-cookie.md) ^1.0.8
- [@types/express](https://npm.io/package/@types/express.md) ^4.17.12

## 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

- 1.1.1 (latest) — 2021-06-14
- 1.1.0 — 2021-06-11
- 1.0.9 — 2021-05-12
- 1.0.8 — 2021-04-13
- 1.0.7 — 2021-04-12
- 1.0.6 — 2021-04-12
- 1.0.5 — 2021-04-12
- 1.0.4 — 2021-04-12
- 1.0.3 — 2021-04-11
- 1.0.2 — 2021-04-11
- 1.0.1 — 2021-04-11
- 1.0.0 — 2021-04-11

## README

# `Socket.IO Cookies Parser` [![Build Status](https://github.com/Links2004/arduinoWebSockets/workflows/CI/badge.svg?branch=master)](https://github.com/nqnghia285/socket.io-cookies-parser.git)

`Socket.IO Cookies Parser` help us handle cookie for Socket.IO[](https://socket.io/)

### Note: After setup success, socket.request.cookies was parsed to JSON object.

### Functions:

```typescript
/**
 * @method namespaceCookieParser setup socket midleware for namespace instance
 * @param socket Socket
 */
function namespaceCookieParser(socket: Socket): void;
```

```typescript
/**
 * @method ioCookieParser setup socket midleware for io instance
 * @param socket Socket
 * @param next (err?: ExtendedError | undefined) => void
 */
function ioCookieParser(socket: Socket, next: (err?: ExtendedError | undefined) => void): void;
```

### Example:

```typescript
//ES6
import socketio from "socket.io";
import { namespaceCookieParser, ioCookieParser } from "socket.io-cookies-parser";
...
const io = new socketio.Server();
io.use(ioCookieParser);
...
const client = io.of("/client", namespaceCookieParser);
...
```

---
_Source: https://npm.io/package/socket.io-cookies-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
