# socket.io-client-cookie

> Monkeypatch to send cookies in socket.io-client handshake library from nodejs

Latest version **0.1.0** (published 2015-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install socket.io-client-cookie
pnpm add socket.io-client-cookie
yarn add socket.io-client-cookie
bun add socket.io-client-cookie
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-07-31 |
| First published | 2015-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Rake Sharm |
| Maintainers | rakeshok |
| Keywords | socket.io, cookie, cookies, nodejs, socket.io-client |

## Links

- npm: https://www.npmjs.com/package/socket.io-client-cookie
- Repository: https://github.com/rakeshok/socket.io-client-cookie
- Issues: https://github.com/rakeshok/socket.io-client-cookie/issues
- npm.io page: https://npm.io/package/socket.io-client-cookie

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

- 0.1.0 (latest) — 2015-07-31

## README

# socket.io-client-cookie

Send cookies from nodejs in the socket.io-client (Monkeypatch)

## What?

SocketIO use a javascript implementation of xmlhttprequest (github.com/driverdan/node-XMLHttpRequest) which does not allow settings cookies due to the specification (http://www.w3.org/TR/XMLHttpRequest/) so this is monkey patch to set cookies in the xmlhttprequest lib used by socket io (./node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest)

Most of the info was taken from here:
https://gist.github.com/jfromaniello/4087861

Discussion:
https://github.com/socketio/socket.io-client/issues/344
https://github.com/socketio/socket.io-client/pull/587

##Usage

###socket.io-client running on nodejs

var newXhr = require('socket.io-client-cookie');
newXhr.setCookies('mycookie=something');
var socketIO = require('socket.io-client')('Somewhere only we now');

###socket.io

var cookieString = socket.request.headers.cookie;
//You can use https://www.npmjs.com/package/socket.io-cookie to parse the cookies or something

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