Emit close/reconnect events on StreamConnections #529
Labels
api: bigquerystorage
Issues related to the googleapis/nodejs-bigquery-storage API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
A screenshot that you have tested with "Try this API".
N/A
What would you like to see in the library?
When using the managedwriter StreamConnection class (as returned by
WriterClient.createStreamConnection()
), I found that the connection often needs to reconnect, but my calling code is unable to determine when this happens.I need to do this because the protoDescriptor needs to be specified for the first write in a connection, but not for subsequent writes, so I need to reset my state to know if I need to write the protoDescriptor again.
Describe alternatives you've considered
My workaround hack was to do
(stream as any)._connection.on('close', ...
and to reregister the listener every time the connection changes, but it would be great to listen to an event directly.Additional context/notes
No response
The text was updated successfully, but these errors were encountered: