Closed Sonny93 closed 6 months ago
0.2.3
For some reasons, we sometimes need to access the HttpContext in Transmit events to perform certains actions based on the current user, wich is currently not possible as we only have access to the randomly generated UUID.
Here is an example :
transmit.on('subscribe', async ({ channel, uid, auth }) => { const myChannel = await Channel.find(channel) if (myChannel) { transmit.broadcast(`channel/${channel}/join`, { user: auth.user }) logger.info(`User ${auth.user.username} joined channel ${myChannel?.name}`) } }) transmit.on('unsubscribe', async ({ channel, uid, auth }) => { const myChannel = await Channel.find(channel) if (myChannel) { transmit.broadcast(`channel/${channel}/leave`, { user: auth.user }) logger.info(`User ${auth.user.username} leaved channel ${myChannel?.name}`) } })
No response
Released in 0.3.0 if you want to try and give some feedback! 👍🏻
0.3.0
Package version
0.2.3
Describe the bug
For some reasons, we sometimes need to access the HttpContext in Transmit events to perform certains actions based on the current user, wich is currently not possible as we only have access to the randomly generated UUID.
Here is an example :
Reproduction repo
No response