<commit_before># Engine.IO: the realtime engine

[![Build Status](https://secure.travis-ci.org/LearnBoost/engine.io.png)](http://travis-ci.org/LearnBoost/engine.io)

`Engine` is the implementation of transport-based cross-browser/cross-device
bi-directional communication layer for
[Socket.IO](http://github.com/learnboost/socket.io).

## Hello World

### Server

#### (A) Listening on a port

```js
var engine = require('engine.io')
  , server = engine.listen(80)

server.on('connection', function (socket) {
  socket.send('utf 8 string');
});
```

#### (B) Intercepting requests for a http.Server

```js
var engine = require('engine.io')
  , http = require('http').createServer().listen(3000)
  , server = engine.attach(http)

server.on('connection', function (socket) {
  socket.on('message', function () { });
  socket.on('close', function () { });
});
```

#### (C) Passing in requests

```js
var ws = require('engine.io')
  , server = new engine.Server()

server.on('connection', function (socket) {
  socket.send('hi');
});

// …<commit_msg>change 'ws' to 'engine' in README C example<commit_after># Engine.IO: the realtime engine

[![Build Status](https://secure.travis-ci.org/LearnBoost/engine.io.png)](http://travis-ci.org/LearnBoost/engine.io)

`Engine` is the implementation of transport-based cross-browser/cross-device
bi-directional communication layer for
[Socket.IO](http://github.com/learnboost/socket.io).

## Hello World

### Server

#### (A) Listening on a port

```js
var engine = require('engine.io')
  , server = engine.listen(80)

server.on('connection', function (socket) {
  socket.send('utf 8 string');
});
```

#### (B) Intercepting requests for a http.Server

```js
var engine = require('engine.io')
  , http = require('http').createServer().listen(3000)
  , server = engine.attach(http)

server.on('connection', function (socket) {
  socket.on('message', function () { });
  socket.on('close', function () { });
});
```

#### (C) Passing in requests

```js
var engine = require('engine.io')
  , server = new engine.Server()

server.on('connection', function (socket) {
  socket.send('hi');
});

// …
{'fraction_non_alphanumeric': 0.19624413145539907, 'fraction_numerical': 0.006572769953051643, 'mean_word_length': 4.667553191489362, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5020836', 'n_tokens_mistral': 720, 'n_tokens_neox': 692, 'n_words': 158}