azure-webpubsub icon indicating copy to clipboard operation
azure-webpubsub copied to clipboard

Documentation on handling `SendMessageError`

Open michaeltnguyen opened this issue 5 months ago • 0 comments

Give us your feedback about our samples

Which sample do you want to give feedback?

https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-web-pubsub/reference-client-sdk-javascript.md#4-send-messages-to-a-group

The sample is not what you want?

In production, we have occasionally run into the following error:

Type: SendMessageError Message: The connection is not connected. File: Stack: SendMessageError: The connection is not connected. at aVn._sendMessageWithAckId @ at async aVn._sendToGroupAttempt @ at async aVn._operationExecuteWithRetry @ at async aVn.sendToGroup

What is the proper way to handle this error?

Should we be checking the connection status before calling sendAsync? In other words, track status via client.on('connected') and client.on('disconnected'). And in that case, while the status is "disconnected", we would need to store all attempted messages so they can be resent once the client has successfully connected? Or does this library do all of that for us already?

michaeltnguyen avatar Sep 27 '24 15:09 michaeltnguyen