/ SDKs / Unity
SDKs
Chat SDKs Unity v4
Chat SDKs Unity
Chat SDKs
Unity
Version 4

Track file upload progress using a handler

Copy link

If needed, you can track the file upload progress by passing the function as an argument to a parameter when calling the SendFileMessage() method.

void OnProgressHandler(string inRequestId, ulong inBytesSent, ulong inTotalBytesSent, ulong inTotalBytesExpectedToSend)
{
    // You can view how much of the file has been uploaded to the server.
    // Implement your logic here.
}

SbFileMessageCreateParams fileMessageCreateParams = new SbFileMessageCreateParams(FILE);

channel.SendFileMessage(fileMessageCreateParams, OnProgressHandler, (inFileMessage, inError) =>
{
    if (inError != null)
        return; // Handle error.

    // The file message has been sent successfully.
    // You can add additional logic here if needed.
});