You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, please forgive me as I am fairly new to the subject and am still learning about upnp and ssdp.
With that said, I am trying to "tap" into the http server request system so that I can handle additional requests however my method seems to give me
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
I suspect because of the way your http server is implemented. It looks like you define httpHandlers to handle requests, but obviously it does not appear that I can tap into that from the peer.
I will provide to you what I have that is giving me the above error in case its simpler then what I am seeing:
functiononRequest(req,res){switch(req.url){case'/discover.json':
if(req.method==='GET')res.end(JSON.stringify(getDiscoverJson()));break;case'/lineup.json':
if(req.method==='GET')res.end(JSON.stringify(getLineupJson()));break;default:
if(req.method==='GET')res.end(JSON.stringify(getDiscoverJson()));}}consthttpServer=http.createServer(onRequest).listen(PORT);console.log(`Listening on ${PORT}`);// ... methods that return an object for the json responses// peerconstpeer=upnp.createPeer({prefix: "/upnp",server: httpServer}).on("ready",async(peer)=>{console.log("Device Ready");device.advertise();}).on("close",(peer)=>{console.log("closed");}).start();constdevice=peer.createDevice({// all my options});
Please advise A.S.A.P
Much appreciated in advance
The text was updated successfully, but these errors were encountered:
First, please forgive me as I am fairly new to the subject and am still learning about
upnp
andssdp
.With that said, I am trying to "tap" into the http server request system so that I can handle additional requests however my method seems to give me
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
I suspect because of the way your http server is implemented. It looks like you define httpHandlers to handle requests, but obviously it does not appear that I can tap into that from the
peer
.I will provide to you what I have that is giving me the above error in case its simpler then what I am seeing:
Please advise A.S.A.P
Much appreciated in advance
The text was updated successfully, but these errors were encountered: