Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.