Skip to content

What's the difference between .close() and .disconnect() in dgram Web Socket #41815

@marsonya

Description

@marsonya

Description of the problem

I am trying to resolve an issue on nodejs/help.
The user reported getting Error [ERR_SOCKET_DGRAM_IS_CONNECTED]: Already connected when reconnecting after deliberately closing the socket connection.

I was able to reproduce the issue using .close() and I also tried .disconnect(). In both cases, I encountered different errors when trying to reconnect after (deliberately) closing/disconnecting the socket.

Here's what I would like to understand:

  • I want to understand the difference between the two methods and their intended behaviour.
  • Should the socket reconnection work after closing the socket?

Based on the explanation I intend to create a PR to fix the issue (if any) and also add more context to descriptions of .close() and .disconnect() in dgram documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    dgramIssues and PRs related to the dgram subsystem / UDP.docIssues and PRs related to the documentations.questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions