Connection status check
mircea-pavel-anton opened this issue · 1 comments
Feature request
Is your feature request related to a problem? Please describe.
When using realtime-js
, for example, there are hooks we can use to check the connection status:
// Socket Hooks
client.onOpen(() => console.log('Socket opened.'))
client.onClose(() => console.log('Socket closed.'))
client.onError((e) => console.log('Socket error', e.message))
While I understand the implementation is different and we are not using sockets for the storage API, I think it would be nice if I could get a feedback when it comes to the connection, to know whether the URL and KEY I passed to the SupabaseStorageClient
constructor are good prior to calling any methods.
Describe the solution you'd like
I am unsure on the way to implement this, but it would be nice if we could have a testConnection
method or maybe have the constructor automatically test the connection and return null
if the parameters aren't ok, so that we know something went wrong.
Upon closer inspection this can be easily achieved by checking if the client object is null and as such i don't think it warrants any changes in the codebase as it is trivial to be implemented by the user. Closing this issue.