12345678910111213141516171819202122 |
- 'use strict';
- const Controller = require('egg').Controller;
- class HomeController extends Controller {
- async index() {
- const { ctx } = this;
- ctx.body = 'hi, egg';
- }
- async exitroom() {
- const { ctx } = this;
- const { uid, roomid } = this.ctx.query;
- // await ctx.app.io.controller.chat.message();
- const newdata = { uid, roomid };
- ctx.app.io.of('/').emit('message', JSON.stringify(newdata));
- // await this.ctx.socket.emit('message', JSON.stringify(newdata));
- ctx.body = 'hi, egg';
- }
- }
- module.exports = HomeController;
|