在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:koajs/koa.io开源软件地址:https://github.com/koajs/koa.io开源编程语言:JavaScript 94.0%开源软件介绍:koa.io![Gitter](https://badges.gitter.im/Join Chat.svg) Realtime web framework combine koa and socket.io. This project is under development now. Feature
Installation$ npm install koa.io --save Usagevar 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. LicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论