surrealdb / surrealdb.js

SurrealDB SDK for JavaScript
https://surrealdb.com
Apache License 2.0
272 stars 45 forks source link

Improve status handling #237

Closed kearfy closed 3 months ago

kearfy commented 3 months ago

Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.

What is the motivation?

Trying to disconnect or reconnect from a failed connection via the WebsocketEngine would throw the error of the previous failed connection. Additionally, because ready and status props were optional on the abstract Engine class, they were not implemented everywhere.

What does this change do?

The .disconnect() method now suppresses any thrown errors from the previous ready state and simply discards the socket and ready state.

What is your testing strategy?

Ensure tests pass

Is this related to any issues?

N/A

Have you read the Contributing Guidelines?