Scanning for printer and receiving requests

Hi there,

I’m making an api and I was wondering if i could have a different thread (or similar) scanning for SSDP NOTIFY messages and updating my db while i have the main one receiving the api requests normally. I’d need to setup a websocket server/client. Can anyone help me?

Thanks!

If anyone wants to know I figured it out by adding a hooks.js and following the documentation on the Ignitors and just created the socket there. I t will launch after the HTTP server as been started.

can you please give me a demo? i’m getting a lot of issues

i’m also trying to workaround within the hooks page but i cannot seem to fire the event

Sure, I created the hooks.js in the ‘start’ file and proceeded to write code for my socket logic.

const { hooks } = require('@adonisjs/ignitor')

hooks.after.httpServer(() => {
      ...
})
1 Like