# carina

> A NodeJS and Browser compatible client for Mixer.com's constellation socket.

Latest version **0.11.2** (published 2019-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install carina
pnpm add carina
yarn add carina
bun add carina
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.11.2 |
| Published | 2019-01-23 |
| First published | 2016-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 123 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | James Birtles |
| Maintainers | mcph |
| Keywords | Constellation, Mixer |

## Links

- npm: https://www.npmjs.com/package/carina
- Repository: https://github.com/mixer/carina
- Homepage: https://github.com/mixer/carina#readme
- Issues: https://github.com/mixer/carina/issues
- npm.io page: https://npm.io/package/carina

## Dependencies (1)

- [pako](https://npm.io/package/pako.md) ^1.0.6

## Recent versions

- 0.11.2 (latest) — 2019-01-23
- 0.11.1 — 2019-01-18
- 0.12.0 — 2019-01-16
- 0.11.0 — 2018-01-31
- 0.10.0 — 2017-11-07
- 0.9.1 — 2017-08-31
- 0.9.0 — 2017-05-09
- 0.8.0 — 2017-04-11
- 0.7.0 — 2017-03-17
- 0.6.0 — 2017-03-17
- 0.5.4 — 2016-12-21
- 0.5.3 — 2016-10-11
- 0.5.2 — 2016-10-07
- 0.5.1 — 2016-09-29
- 0.5.0 — 2016-09-15
- … 8 more at https://npm.io/package/carina/versions

## README

# Carina [![Build Status](https://travis-ci.org/mixer/carina.svg?branch=master)](https://travis-ci.org/mixer/carina)

## Installation
You can either use npm (recommended) or download the zip from the [releases page](https://github.com/mixer/carina/releases).

### Browser
```html
<script src="js/carina.js"></script>
```

### Node
```
npm i --save carina
```

## Usage
### Browser

#### index.html
```html
<doctype html>
<html>
    <head>
        <title>Carina</title>
    </head>
    <body>
        <script src="js/carina.js"></script>
        <script src="js/app.js"></script>
    </body>
</html>
```

#### app.js
```js
var ca = new carina.Carina().open();
ca.subscribe('channel:1:update', function (data) {
    console.log('Channel update', data);
});
```
### Node

#### JavaScript
```js
const Carina = require('carina').Carina;
const ws = require('ws');

Carina.WebSocket = ws;

// Note: You MUST set isBot if the client is
// an automated bot and you are NOT authing.
const ca = new Carina({ isBot: true }).open();
ca.subscribe('channel:1:update', data => {
    console.log('Channel update', data);
});
```

#### TypeScript
```ts
import { Carina } from 'carina';
import * as ws from 'ws';

Carina.WebSocket = ws;

const ca = new Carina({ isBot: true }).open();
ca.subscribe<ChannelUpdate>('channel:1:update', data => {
    console.log('Channel update', data);
});

// Example interface, does not contain all possible values.
interface ChannelUpdate {
    online?: boolean;
}
```

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