Sha256: a9cf6aaf99e447f1552c132616fcffc72535f13d315c1b87bd812be306b7caa4

Contents?: true

Size: 871 Bytes

Versions: 2

Compression:

Stored size: 871 Bytes

Contents

require "sync_service"

RPC.logging = true

client = SyncService::Client.setup("http://127.0.0.1:8080/test_application")

# Get result of an existing method.
puts "Server timestamp is #{client.server_timestamp}"

# Get result of a non-existing method via method_missing.
puts "Method missing works: #{client + 1}"

# Synchronous error handling.
begin
  client.buggy_method
rescue MobME::Infrastructure::RPC::Error => exception
  STDERR.puts "EXCEPTION CAUGHT: #{exception.inspect}"
end

# Notification isn't supported, because HTTP works in
# request/response mode, so it does behave in the same
# manner as rpc via method_missing. Sense of this is
# only to check, that it won't blow up.
puts "Sending a notification ..."
client.notification(:log, "Some shit.")

# Batch.
result = client.batch([[:log, ["Message"], nil], [:a_method, []]])
puts "Batch result: #{result}"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sync_service-0.1.0 examples/client.rb
sync_service-0.0.8 examples/client.rb