Skip to content

KeepAlive causing send after finish? #6

@dimitricole

Description

@dimitricole

Hi - I am trying to use this code in my project but if I connect a socket, disconnect the socket, and wait a few seconds, keepAlive throws an error:

/Users/xxxxxx/src/xxxxxx/server/node_modules/websocket/lib/W3CWebSocket.js:111
throw new Error('cannot call send() while not connected');
^
Error: cannot call send() while not connected
at W3CWebSocket.send (/Users/xxxxxx/src/xxxxxx/server/node_modules/websocket/lib/W3CWebSocket.js:111:15)
at LiveClient.keepAlive (/Users/xxxxxx/src/xxxxxx/server/node_modules/@deepgram/sdk/dist/main/packages/LiveClient.js:55:22)
at Timeout._onTimeout (/Users/xxxxxx/src/xxxxxx/server/server.js:34:14)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)

Any patterns documented for keepAlive in node? I'm confused why in this code example, keepAlive is globally scoped since it is being created / overwritten per socket?

Sidenote - also curious if best practice is to have one Deepgram client per socket, or share the same client?

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