koajs / koa.io

[MAINTAINERS WANTED] Realtime web framework combine koa and socket.io.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Emitting from a endpoint

DarrylD opened this issue · comments

When the client hits an endpoint, trying to do something like so

var router = require('koa-router')();

router.get('/test', function *(next) {

    //this.brodcast?

    this.body = dostuff();
})

Is this possible? Want to send messages to clients when endpoints are hit.

@DarrylD heya! Sorry for the delay.

Is this possible?

Yea, I believe you can access do this.io.broadcast, because we have this.io in the app instance.