# signal.io

> A realtime application framework for building Web API based on WebSocket

Latest version **0.0.6** (published 2013-08-29) · 0 weekly downloads

## Install

```sh
npm install signal.io
pnpm add signal.io
yarn add signal.io
bun add signal.io
```

## 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.0.6 |
| Published | 2013-08-29 |
| First published | 2013-07-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Naoyuki Kanezawa |
| Maintainers | nkzawa |
| Keywords | real-time, framework, websocket, socket.io, connect, api, rest |

## Links

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

## Dependencies (4)

- [debug](https://npm.io/package/debug.md) *
- [socket.io](https://npm.io/package/socket.io.md) nkzawa/socket.io
- [socket.io-bundle](https://npm.io/package/socket.io-bundle.md) 0.0.4
- [socket.io-stream](https://npm.io/package/socket.io-stream.md) 0.3.1

## 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.0.6 (latest) — 2013-08-29
- 0.0.5 — 2013-08-11
- 0.0.4 — 2013-08-04
- 0.0.3 — 2013-08-01
- 0.0.2 — 2013-07-30
- 0.0.1 — 2013-07-13
- 0.0.0 — 2013-07-13

## README

# Signal.IO
[![Build Status](https://travis-ci.org/nkzawa/signal.io.png?branch=master)](https://travis-ci.org/nkzawa/signal.io)
[![NPM version](https://badge.fury.io/js/signal.io.png)](http://badge.fury.io/js/signal.io)

Signal.IO is a realtime application framewrork for building Web API based on WebSocket instead of HTTP.

```js
var signal = require('signal.io');
var server = require('http').Server();
var io = signal(server);

io.connect('/', function(socket) {
  socket.on('get', function(req, res) {
    res.send('Hello World');
  });
});

server.listen(3000);
```

## Installation
    $ npm install signal.io

## Features
* Built on [Socket.IO](https://github.com/learnboost/socket.io) v1.0
* [Express](https://github.com/visionmedia/express) inspired API and interface
* Namespace routing
* Bundled middlewares
* Easy broadcasting

## Example

**Server:**
```js
var signal = require('signal.io');
var server = require('http').Server();
var io = signal(server);

// set middlewares
io.use(signal.cookieParser());
io.use(signal.session('my secret'));

io.connect('/posts/:postId', function(socket) {
  socket.on('read', function(req, res) {
    var post = {id: req.params.postId, title: 'A post'};
    res.send(post);
  });

  socket.on('update', function(req, res) {
    var post = req.body;
    // do update ...

    // send back the result and broadcast it to all clients joined in the same namespace.
    res.broadcast.send(post);
  });
});

server.listen(3000);
```

**Client:**

Use Socket.IO as the client.

```html
<script src="/signal.io/socket.io.js"></script>
<script>
var socket = io('http://localhost:3000/posts/10', {path: '/signal.io'});
socket.on('connect', function() {
  socket.emit('read', function(err, post) {
    console.log('Read a post', post);
  });

  var post = {title: 'Hello, World'}
  socket.emit('update', post, function(err, post) {
    console.log('Update result', post);
  });

  socket.on('update', function(post) {
    console.log('Received a result of other clients', post);
  });
});
</script>
```

## License
MIT

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