home.js 435 B

1234567891011121314151617181920
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. class HomeController extends Controller {
  4. async index() {
  5. const { ctx } = this;
  6. ctx.body = 'hi, egg';
  7. }
  8. async exitroom() {
  9. const { ctx } = this;
  10. const { uid, roomid } = this.ctx.query;
  11. const newdata = { uid, roomid };
  12. this.ctx.socket.emit('message', JSON.stringify(newdata));
  13. ctx.body = 'hi, egg';
  14. }
  15. }
  16. module.exports = HomeController;