Since the server side of sockjs is a stream, it needs to implement destroy
as destroy is called by pipe in some cases.
It should basically do what close does, but without asking.
It should just terminate any connection... which will mean calling destroy
on whatever underling stream is currently in use.
oh, oops, I see do implement destroy.
but not correctly.
you should not removeAllListeners
destroy should set this.writable = false
dispose of any resources, and then emit 'close'
this.writable = false
indeed, pipe, will listen on 'close' and calling this.removeAllListeners() will leave pipe hanging.
I am working on a guide for correct streams.
it should be helpful.
Yes, destroy is implemented already:
Correct me if I'm wrong about removeAllListeners but node docs say:
Closes the underlying file descriptor. Stream will not emit any more events.
oh, thats a mistake in the documentation. I'll look into getting that fixed.
it should be "no more 'data', 'end', or 'drain' events will be emitted"
look here, in fs
and here in net
destroy causes either 'close' or 'error' to be emmited.
my pull request has been merged, and the documentation is now corrected.
Great! Destroy definitely should be modified to adhere to the new docs. Now the ball is on my side.
Any updates on this?
This applied to old streams, but now we should be using stream.Duplex
#79 Don't remove listeners until after end so 'close' event gets emit…
@dominictarr Do you think my change is sufficient to fix this issue?
I think this is fixed by my commit. Reopen if you think otherwise.
Fix #79, avoid using XDRObject when connecting across schemes