#How do i close a receiver subscription (opus stream)
38 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
✅Marked as resolved by staff
uhhh, can someone help here??
Destroying the connection should end all VoiceReceiverStreams of that connection 
But you can always call .destroy() on it manually if not
I had logged opusstream.closed and it was false
on what? the receiver? the receiver haves no method called destroy
on the opus stream itself
it doesnt show errors
but i want to make sure of something
how do i check if it was destroyed
<Readable>.destroyed exists
ohk, thanks alot
must i await destroy() ?
coz .destroyed is false
no, it's synchronous
just to confirm before addressing this, could you share your updated code?
yes
just a second
setTimeout(() => this.opusStream.destroy(), after);
this.emit('stop-listining-stream');
console.log(this.opusStream.destroyed);
return this;
}```
its a class Player
you're checking immediately after setting the timeout, not when the timeout actually times out
I imagine this was also the case for previously when you were checking closed
oh, yeah it is destroyed
also wait i need your help please quickly with something else, not really djs related
but no one answers in all the servers
can you help?
I don't know how I can answer whether I can help if I don't know what you need help with, but if it's not really djs related, #1081585952654360687 sounds like the channel for you
its a streams thing
createListeningStream(usersIds, writeStream, end) {
const receiver = this.connection.receiver;
this.opusStream = [];
usersIds.forEach((userId) => {
const opusStream = receiver.subscribe(userId, {
end: EndBehaviorType.Manual,
});
const opusDecoder = new prism.opus.Decoder({
frameSize: 960,
channels: 2,
rate: 48000,
});
this.opusStream = opusStream;
opusStream.pipe(opusDecoder).pipe(writeStream);
});
this.emit('create-listining-stream');
return this;
}
Simply the opus stream gets destroyed
but the writestream is gridfsbucket for mongodb is not getting saved in collection.files, but chunks get saved at collection.chunks
do you have any idea?
I don't really use mongo, no
I'd definitely recommend posting in #1081585952654360687
ok