Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Add WebSocket connected() function #656

Merged

Conversation

hjoelr
Copy link
Contributor

@hjoelr hjoelr commented Jan 3, 2022

This is a helper function for determining if the underlying WebSocket has not yet closed. Needing to know this was the main reason I requested #608 to make the socket public. If you think it'd be okay, we could probably revert that change with this. The issue is that some people may be relying on the socket being public now.

Also, I wasn't sure what your preference would be a connected() function or a getter property. I can change if you prefer that.

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2022

Codecov Report

Merging #656 (92249e4) into main (6c79874) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #656   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines          509       531   +22     
  Branches        39        39           
=========================================
+ Hits           509       531   +22     
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/client/WebSocketClient.ts 100.00% <ø> (ø)

@bennycode
Copy link
Owner

Hi @hjoelr, let's make it a getter function. The socket can stay public because otherwise we would break the API contract. :)

@hjoelr hjoelr force-pushed the feature/ws-connected-helper-function branch from 51ff268 to 92249e4 Compare January 3, 2022 22:16
@bennycode bennycode merged commit 7947d7f into bennycode:main Jan 3, 2022
@bennycode
Copy link
Owner

Thanks again @hjoelr. 🙏 All your changes are now live with v3.1.0 -> https://www.npmjs.com/package/coinbase-pro-node/v/3.1.0

@hjoelr
Copy link
Contributor Author

hjoelr commented Jan 3, 2022

@bennycode You're welcome. My next contribution will hopefully be based off the idea in #421.

@hjoelr hjoelr deleted the feature/ws-connected-helper-function branch January 4, 2022 19:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants