Skip to content

How should we handle unstable or missing WebSocket connections? #26

@subb24

Description

@subb24

Hi team,

I'm encountering an issue when the WebSocket connection is unstable or missing. Specifically, I'm seeing the following error

ReferenceError: WebSocket is not defined
    at Timeout._onTimeout (/Users/susu/comfyui-api/node_modules/@saintno/comfyui-sdk/build/index.cjs:1:16526)
    at listOnTimeout (node:internal/timers:569:17)
    at processTimers (node:internal/timers:512:7)

This happens in a Node.js environment, where the WebSocket global is not available by default.

I have a couple of questions:

Should the SDK handle the absence or failure of WebSocket more gracefully?

Is there a recommended pattern for handling reconnection or fallback logic in this case?

Would it make sense to allow passing in a custom WebSocket implementation (e.g., ws for Node) as a config?

Any guidance or best practices would be appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions