Timeout

One common error is a request timeout. This error occurs if the local machine didn’t get a response from the server in a set amount of time.

The possible causes for this are:

  • there is a problem in connectivity between the client and the server: either the request or the response could not get through,

  • the server received the request but could not process it due to some internal error, or

  • the response from the server came back but the client rejected it because the latency was too long, or the timeout was set to too small a number.

In the last case, you can increase the timeout value.

The other reason why you might want to change this value is if losing network connectivity is a frequent occurrence for you and you don’t want to wait very long for the failure callback to get called every time this happens. In this case you can decrease the value. In general, you have to keep a balance between large and small values for timeout.

The timeout is set for each particular action separately. This means you cannot change a common default value for all calls at once.

Most of the actions in the SDK support this. You should look for a RequestConfig passed as the last argument. For instance, the SetRoomMember method of the StrixNetwork singleton has the following signature.

void SetRoomMember(long memberId, RoomMemberProperties memberProperties, RoomMemberSetEventHandler handler, FailureEventHandler failureHandler, RequestConfig config = null)

If the config argument is null, the default value of 30 seconds is used.

The RequestConfig class has a field called Timeout. It is specified in milliseconds so if you want a timeout of 10 seconds, you should set it to 10000, like so:

SetRoomMember(
    memberId: 0,
    memberProperties: new RoomMemberProperties { name = "Cliff" },
    handler: null,
    failureHandler: null,
    config: new RequestConfig { Timeout = 10000 }
);