# @steeplejack/socketio

> SocketIO strategy for Steeplejack

Latest version **1.0.0** (published 2017-07-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @steeplejack/socketio
pnpm add @steeplejack/socketio
yarn add @steeplejack/socketio
bun add @steeplejack/socketio
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-07-10 |
| First published | 2017-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Simon Emms |
| Maintainers | steeplejack |
| Keywords | steeplejack, socketio |

## Links

- npm: https://www.npmjs.com/package/@steeplejack/socketio
- Repository: https://github.com/steeplejack-js/socketio
- Homepage: https://github.com/steeplejack-js/socketio#readme
- Issues: https://github.com/steeplejack-js/socketio/issues
- npm.io page: https://npm.io/package/@steeplejack/socketio

## 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.0.0 (latest) — 2017-07-10
- 0.1.0 — 2017-05-09

## README

# Steeplejack SocketIO

[SocketIO](http://socket.io) strategy for [Steeplejack](http://steeplejack.info)

# Usage

In your [Steeplejack](http://getsteeplejack.com) bootstrapping, you'll need to import this SocketIO plugin into the
`modules` section:

> You will need to also include an HTTP server strategy. This example uses Restify, but you can use any of the other
> HTTP strategies in exactly the same way.

### app.js

```javascript
const Steeplejack = require('steeplejack');
const restify = require('@steeplejack/restify');
const socketIO = require('@steeplejack/socketio');

/* Bootstrap the Steeplejack app */
const app = Steeplejack.app({
  config: {},
  modules: [
    `${__dirname}/!(node_modules|routes)/**/*.js`,
    restify,
    socketIO,
  ],
  routesDir: `${__dirname}/routes`,
});

app.run(['server'], server => server);
```

### server.js

```javascript
exports.default = (Server, config, { Restify }, { SocketIO }) => {
  const restify = new Restify();
  const socketIo = new SocketIO();

  /* Add the websocket strategy as the third argument */
  return new Server(config.server, restify, socketIo);
};

exports.inject = {
  name: 'server',
  deps: [
    'steeplejack-server',
    '$config',
    'steeplejack-restify',
    'steeplejack-socketio',
  ],
};
```

This attaches the SocketIO strategy to the current HTTP server allowing you to make websocket connections on the same
server and port as your HTTP server.

The `steeplejack-socketio` dependency exposes two elements, `SocketIO` (the strategy) and `SocketIOLib` (the socketio 
library).

# License

MIT License

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