liuyu 4 jaren geleden
bovenliggende
commit
1e8e4a1878
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3 2
      app/controller/home.js

+ 3 - 2
app/controller/home.js

@@ -11,9 +11,10 @@ class HomeController extends Controller {
   async exitroom() {
     const { ctx } = this;
     const { uid, roomid } = this.ctx.query;
-    await this.ctx.controller.chat.index();
+    // await ctx.app.io.controller.chat.message();
     const newdata = { uid, roomid };
-    this.ctx.socket.emit('message', JSON.stringify(newdata));
+    ctx.app.io.of('/').emit('message', JSON.stringify(newdata));
+    // await this.ctx.socket.emit('message', JSON.stringify(newdata));
     ctx.body = 'hi, egg';
   }
 }