`Client#sync` fails with `Net::ReadTimeout` on large timeout values
Client#sync takes a timeout parameter which is the amount of time to wait in case no new events are happening.
Net:HTTP#read_timeout is the amount of time until Net::ReadTimeout is raised in case the read syscall does not return. The default for this is 60 (seconds).
When calling Client#sync with a large timeout (e.g. 10 minutes), Net::ReadTimeout is raised before the server responds with an empty response.
As a workaround Client#sync can be called multiple times with a small timeout value.
The Matrix protocol itself works better when the client runs syncs more often, since that shrinks the window that the sync token might have to calculate. But if long-period syncs are necessary then you can modify that setting on the API object;
client = MatrixSdk::Client.new('https://matrix.example.com', read_timeout: 600)
# Or with an existing Client/API object;
client.api.read_timeout = 600
Bear in mind that even if your client is set to allow for a longer read timeout, the Matrix server on the other end might have a reverse proxy in front of it that could abort the connection as well.