socket.io for koa extend.
$ npm install @koex/socket.io
import withSocketIO from '@koex/socket.io';
import * as Koa from 'koa';
const app = new Koa();
withSocketIO(app);
app.use(cors());
app.use(ctx => {
ctx.body = 'Hello, World!';
});
// app.io is the socket.io instance
app.io.on('connection', socket => {
// do something
});
app.listen(8000, '0.0.0.0', () => {
console.log('koa server start at port: 8000');
});