Skip to content

koexjs/socket.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

socket.io

NPM version Coverage Status Dependencies Build Status license issues

socket.io for koa extend.

Install

$ npm install @koex/socket.io

Usage

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');
});

Related