A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/koajs/koa.io below:

koajs/koa.io: [MAINTAINERS WANTED] Realtime web framework combine koa and socket.io.

![Gitter](https://badges.gitter.im/Join Chat.svg)

Realtime web framework combine koa and socket.io.

This project is under development now.

$ npm install koa.io --save
var koa = require('koa.io');

var app = koa();

// middleware for koa
app.use(function*() {
});


// middleware for socket.io's connect and disconnect
app.io.use(function* (next) {
  // on connect
  yield* next;
  // on disconnect
});

// router for socket event
app.io.route('new message', function* () {
  // we tell the client to execute 'new message'
  var message = this.args[0];
  this.broadcast.emit('new message', message);
});

app.listen(3000);

Please check out this simple chat example.

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4