![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
adonisjs-sse
Advanced tools
An addon/plugin package to provide server-sent events functionality for AdonisJS 4.0+
An addon/plugin package to provide server-sent events functionality for AdonisJS 4.0+
adonis install adonisjs-sse
Setup serve-sent events route inside start/routes.js
file.
/** @type {typeof import('@adonisjs/framework/src/Route/Manager')} */
const Route = use('Route');
Route.get('/stream', ({ source }) => {
// send a server-sent events comment
source.send(null, '!This is a comment!');
})//.middleware(['eventsource']);
Route.post('/send/email', 'NotificationsController.sendEmail')
See the instructions.md file for the complete installation steps and follow as stated.
HINT: It would be much easier and better to make the
EventSourceWatcher
middleware a global middleware
Setup a controller to dispatch server-sent events to the browser using the
source.send()
method like so:
/** @type {typeof import('@adonisjs/mail/src/Mail')} */
const Mail = use('Mail')
class NotificationsController {
async sendEmail ({ request, auth, source }){
let input = request.only([
'ticket_user_id'
]);
let { id, email, fullname } = await auth.getUser();
let error = false
try{
await Mail.send(
'emails.template',
{ fullname }, (message) => {
message.to(email)
message.from('crm.tickets@funsignals.co')
message.subject('Ticket Creation Job Status')
})
}catch(err){
error = true
}finally{
source.send({
ticket_reciever: id,
ticket_creator: input.ticket_user_id,
ticket_mail_status: `email sent ${error ? 'un' : ''}successfuly`
}, null, 'update')
}
}
}
module.exports = NotificationsController
MIT
npm i
npm run lint
npm run test
See the CONTRIBUTING.md file for info
Coolcodes is a non-profit software foundation (collective) created by Oparand - parent company of StitchNG, Synergixe based in Abuja, Nigeria. You'll find an overview of all our work and supported open source projects on our Facebook Page.
Follow us on facebook if you can to get the latest open source software/freeware news and infomation.
Does your business depend on our open projects? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
0.1.1 (2019-10-22)
Initial Release
FAQs
An addon/plugin package to provide server-sent events functionality for AdonisJS 4.0+
The npm package adonisjs-sse receives a total of 4 weekly downloads. As such, adonisjs-sse popularity was classified as not popular.
We found that adonisjs-sse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.