Method: MatrixSdk::Protocols::CS#sync

Defined in:
lib/matrix_sdk/protocols/cs.rb

#sync(timeout: 30.0, **params) ⇒ Response

Runs the client API /sync method

Parameters:

  • timeout (Numeric) (defaults to: 30.0)

    (30.0) The timeout in seconds for the sync

  • params (Hash)

    The sync options to use

Options Hash (**params):

  • :since (String)

    The value of the batch token to base the sync from

  • :filter (String, Hash)

    The filter to use on the sync

  • :full_state (Boolean)

    Should the sync include the full state

  • :set_presence (Boolean)

    Should the sync set the user status to online

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/matrix_sdk/protocols/cs.rb', line 58

def sync(timeout: 30.0, **params)
  query = params.select do |k, _v|
    %i[since filter full_state set_presence].include? k
  end

  query[:timeout] = (timeout * 1000).to_i if timeout
  query[:timeout] = params.delete(:timeout_ms).to_i if params.key? :timeout_ms
  query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)

  request(:get, :client_r0, '/sync', query: query)
end