Skip to content
Discussion options

You must be logged in to vote

Hi! Setting autoUnref to true will allow the program to exit, even if the socket is currently connected.

const socket = io({
  autoUnref: true
});

setTimeout(() => {
  // program will now exit
}, 1000);

Without it, you will indeed need to call socket.disconnect().

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@qiulang
Comment options

@darrachequesne
Comment options

@qiulang
Comment options

@qiulang
Comment options

@qiulang
Comment options

Answer selected by qiulang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants