# hapio

> A simple bridge plugin between hapi and socket.io

Latest version **2.0.0** (published 2017-11-01) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-11-01 |
| First published | 2014-11-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Caligone |
| Maintainers | caligone |
| Keywords | hapi, socket, websocket, socketio, api, plugin |

## Links

- npm: https://www.npmjs.com/package/hapio
- Repository: https://github.com/Caligone/hapio
- Issues: https://github.com/Caligone/hapio/issues
- npm.io page: https://npm.io/package/hapio

## Dependencies (2)

- [hoek](https://npm.io/package/hoek.md) ^5.0.1
- [socket.io](https://npm.io/package/socket.io.md) ^2.0.4

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

- 2.0.0 (latest) — 2017-11-01
- 1.4.0 — 2017-01-23
- 1.3.4 — 2016-08-18
- 1.3.3 — 2016-04-06
- 1.3.2 — 2016-02-23
- 1.3.1 — 2015-10-30
- 1.3.0 — 2015-10-30
- 1.2.4 — 2015-10-16
- 1.2.3 — 2015-08-26
- 1.2.2 — 2015-03-29
- 1.2.1 — 2015-03-25
- 1.2.0 — 2015-03-25
- 1.1.0 — 2014-12-14
- 1.0.1 — 2014-12-05
- 1.0.0 — 2014-11-30

## README

hapio
=====

[![Dependency Status](https://david-dm.org/Caligone/hapio.svg)](https://david-dm.org/Caligone/hapio)
[![devDependency Status](https://david-dm.org/Caligone/hapio/dev-status.svg)](https://david-dm.org/Caligone/hapio#info=devDependencies)
[![Build Status](https://travis-ci.org/Caligone/hapio.svg?branch=master)](https://travis-ci.org/Caligone/hapio)
[![Coverage Status](https://coveralls.io/repos/Caligone/hapio/badge.svg?branch=master)](https://coveralls.io/r/Caligone/hapio?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/Caligone/hapio.svg)](https://greenkeeper.io/)

A simple bridge plugin between HapiJS and SocketIO.

### Plugin registration

```js
const server = new Hapi.Server({
    port: 3000,
    host: 'localhost',
});

async function start() {
    try {
        await server.register(hapio, {
            serverOptions: {
                // socket.io options
            }
        });
        await server.start();
    } catch (e) {
        console.error(e);
    }
}
start();
 ```

### Using hapio

```js
const io = server.plugins.hapio.io;

io.on('connection', function(socket) {
    console.log(`${socket.id} connected !`);
    socket.on('test', function(e) {
        console.log('Test received !');
    });
});
 ```


### hapio options

 * `serverOptions`: (*Not required/Defaults to an empty object*) [Options to pass to socket.io's constructor](https://socket.io/docs/server-api/#new-server-httpserver-options).


### A great idea?

Do not hesitate to make a pull request

### An issue with hapio?

Just open an issue on [Github](https://github.com/Caligone/hapio/issues) and I will fix it as soon as possible

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