Back to Explore

szmarczak/defer-to-connect

GitHub
1 watchersOpen source

Last release:

Defer-to-connect is a small Node.js helper for handling the `connect` socket event safely. It ensures your callback or listener functions run only when the socket is actually connected (and can also call `secureConnect` and `close` handlers). This is useful to avoid manual checks when a socket may already be connected or disconnected.

Project status

  • This GitHub source appears largely dormant, with the most recent updates dating to 2021-05-12, which is about 5 years ago relative to 2026-08-12, so it is not actively maintained in the present day.
  • The apparent update cadence was active in the earlier years (multiple updates around 2019 to early 2021), but it has effectively stopped after 2021, with no newer updates shown since v2.0.1.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v2.0.1

    v2.0.1 makes a small internal change to how the library detects TLS sockets, and updates a couple of TypeScript and test tooling configuration details in package.json. No release notes were provided, so the functional impact must be inferred from the code and manifest diff.

    Breaking
  • v2.0.0

    Release v2.0.0 primarily updates development tooling dependencies and removes support for Node 8. The code diff, however, also changes how the package is built and published (entrypoint and TypeScript typings paths), which can affect consumers that rely on package layout.

    Breaking
  • v1.1.3

    Release v1.1.3 makes a small behavioral adjustment in the TLS secureConnect handling logic and updates the package manifest for publishing. The release notes only mention excluding tsconfig.json, but the diff also shows changes to secureConnect listener attachment conditions and publishing-related configuration.

  • v1.1.0

    v1.1.0 expands defer-to-connect to accept an object of listeners instead of only a single connect callback. The implementation is moved to TypeScript with a new deferToConnect function that can invoke connect, secureConnect, and close handlers depending on socket state.

    Features
  • v1.0.2

    This release (v1.0.2) changes the library API for deferring work until a socket is connected. The code now only supports passing a callback function, instead of allowing a socket method name and arguments.

    Breaking
  • 1.0.1

    This release fixes a callback invocation issue during connection setup. Previously, the callback could be called while the client was still connecting, which may have led to incorrect application behavior.