Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dgramIssues and PRs related to UDP and the dgram module.docIssues and PRs related to Node.js documentation.questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions