rhoconnect 3.4.5 → 4.0.0.beta.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (337) hide show
  1. data/CHANGELOG.md +57 -3
  2. data/Gemfile +9 -7
  3. data/Gemfile.lock +37 -37
  4. data/Rakefile +18 -7
  5. data/bench/benchapp/Gemfile +1 -1
  6. data/bench/benchapp/config.ru +0 -3
  7. data/bench/benchapp/controllers/ruby/application.rb +17 -0
  8. data/bench/benchapp/controllers/ruby/application_controller.rb +17 -0
  9. data/bench/benchapp/controllers/ruby/mock_adapter_controller.rb +8 -0
  10. data/bench/benchapp/controllers/ruby/queue_mock_adapter_controller.rb +8 -0
  11. data/bench/benchapp/{sources → models/ruby}/mock_adapter.rb +1 -1
  12. data/bench/benchapp/{sources → models/ruby}/queue_mock_adapter.rb +0 -0
  13. data/bench/benchapp/spec/{sources → models/ruby}/mock_adapter_spec.rb +1 -1
  14. data/bench/benchapp/spec/{sources → models/ruby}/queue_mock_adapter_spec.rb +1 -1
  15. data/bench/benchapp/spec/spec_helper.rb +2 -2
  16. data/bench/blobapp/Gemfile +1 -1
  17. data/bench/blobapp/config.ru +0 -3
  18. data/bench/blobapp/controllers/ruby/application_controller.rb +17 -0
  19. data/bench/blobapp/controllers/ruby/blob_adapter_controller.rb +8 -0
  20. data/bench/blobapp/{sources → models/ruby}/blob_adapter.rb +9 -2
  21. data/bench/blobapp/spec/{sources → models/ruby}/blob_adapter_spec.rb +1 -1
  22. data/bench/blobapp/spec/spec_helper.rb +1 -1
  23. data/bench/lib/bench/cli.rb +1 -1
  24. data/bench/scripts/blob_cud_script.rb +1 -1
  25. data/bench/scripts/query_md_script.rb +1 -1
  26. data/bench/scripts/query_only_script.rb +1 -1
  27. data/bench/scripts/query_script.rb +1 -1
  28. data/bench/scripts/test_query_script.rb +7 -1
  29. data/bench/spec/mock_adapter_spec.rb +1 -1
  30. data/bench/spec/result_spec.rb +3 -3
  31. data/bin/rhoconnect +5 -3
  32. data/commands/dtach/dtach_install.rb +2 -2
  33. data/commands/execute.rb +8 -3
  34. data/commands/generators/app.rb +3 -3
  35. data/commands/generators/controller.rb +6 -0
  36. data/commands/generators/model.rb +6 -0
  37. data/commands/generators/source.rb +3 -3
  38. data/commands/generators/update.rb +1 -1
  39. data/commands/redis/redis_about.rb +2 -2
  40. data/commands/redis/redis_download.rb +1 -1
  41. data/commands/redis/redis_install.rb +4 -3
  42. data/commands/redis/redis_restart.rb +4 -4
  43. data/commands/redis/redis_start.rb +5 -4
  44. data/commands/redis/redis_startbg.rb +5 -4
  45. data/commands/redis/redis_status.rb +13 -0
  46. data/commands/redis/redis_stop.rb +3 -3
  47. data/commands/rhoconnect/config.rb +28 -16
  48. data/commands/rhoconnect/flushdb.rb +1 -2
  49. data/commands/rhoconnect/get_token.rb +15 -11
  50. data/commands/rhoconnect/restart.rb +13 -5
  51. data/commands/rhoconnect/set_admin_password.rb +8 -8
  52. data/commands/rhoconnect/start.rb +74 -16
  53. data/commands/rhoconnect/startbg.rb +1 -1
  54. data/commands/rhoconnect/startdebug.rb +1 -1
  55. data/commands/rhoconnect/stop.rb +13 -1
  56. data/commands/rhoconnect/web.rb +5 -5
  57. data/commands/rhoconnect_console/console.rb +7 -5
  58. data/commands/{rhoconnect → rhoconnect_spec}/spec.rb +0 -0
  59. data/commands/rhoconnect_war/war.rb +9 -9
  60. data/commands/utilities/blank_app.ru +56 -0
  61. data/commands/utilities/redis_runner.rb +54 -19
  62. data/doc/authentication.txt +80 -6
  63. data/doc/blob-sync.txt +104 -97
  64. data/doc/bulk-sync.txt +1 -1
  65. data/doc/client-java.txt +3 -3
  66. data/doc/client-objc.txt +2 -2
  67. data/doc/client.txt +4 -4
  68. data/doc/command-line.txt +105 -200
  69. data/doc/data-partitioning.txt +40 -0
  70. data/doc/deploying.txt +249 -77
  71. data/doc/extending-rhoconnect-server.txt +40 -57
  72. data/doc/heroku-addon.txt +2 -0
  73. data/doc/install.txt +45 -95
  74. data/doc/introduction.txt +1 -1
  75. data/doc/java-plugin.txt +365 -190
  76. data/doc/metadata.txt +1 -1
  77. data/doc/migration.txt +108 -142
  78. data/doc/preparing-production.txt +1 -1
  79. data/doc/push-backend-setup.txt +2 -0
  80. data/doc/push-client-setup-android.txt +78 -0
  81. data/doc/push-client-setup-bb.txt +81 -0
  82. data/doc/push-client-setup-ios.txt +70 -0
  83. data/doc/push-client-setup-rps.txt +200 -0
  84. data/doc/push-client-setup.txt +63 -66
  85. data/doc/push-server-setup.txt +67 -40
  86. data/doc/push-testing.txt +29 -0
  87. data/doc/push.txt +21 -6
  88. data/doc/rest-api.txt +128 -55
  89. data/doc/rhoconnect-redis-stack.txt +120 -0
  90. data/doc/settings.txt +4 -12
  91. data/doc/source-adapters-intro.txt +28 -0
  92. data/doc/source-adapters.txt +235 -272
  93. data/doc/stats-middleware.txt +9 -29
  94. data/doc/supported-platforms.txt +21 -30
  95. data/doc/testing.txt +40 -42
  96. data/doc/tutorial.txt +72 -57
  97. data/examples/simple/Gemfile +1 -1
  98. data/examples/simple/application.rb +4 -5
  99. data/examples/simple/my_server.rb +2 -2
  100. data/examples/simple/settings/settings.yml +1 -1
  101. data/generators/rhoconnect.rb +151 -50
  102. data/generators/templates/application/Gemfile +1 -1
  103. data/generators/templates/application/Rakefile +3 -3
  104. data/generators/templates/application/config.ru +1 -4
  105. data/generators/templates/application/controllers/application_controller.rb +17 -0
  106. data/generators/templates/application/controllers/js/application_controller.js +14 -0
  107. data/generators/templates/application/controllers/ruby/application_controller.rb +17 -0
  108. data/generators/templates/application/package.json +8 -0
  109. data/generators/templates/application/rcgemfile +2 -5
  110. data/generators/templates/application/settings/settings.yml +3 -3
  111. data/generators/templates/application/spec/application_controller_spec.rb +23 -0
  112. data/generators/templates/application/spec/js_spec.rb +25 -0
  113. data/generators/templates/application/spec/spec_helper.rb +21 -7
  114. data/generators/templates/source/controllers/js/controller.js +7 -0
  115. data/generators/templates/source/controllers/ruby/controller.rb +8 -0
  116. data/generators/templates/source/controllers/ruby/controller_spec.rb +27 -0
  117. data/generators/templates/source/models/js/model.js +46 -0
  118. data/generators/templates/source/{source_adapter.rb → models/ruby/model.rb} +15 -10
  119. data/generators/templates/source/{source_spec.rb → models/ruby/model_spec.rb} +1 -1
  120. data/install.sh +5 -5
  121. data/installer/unix-like/create_texts.rb +2 -2
  122. data/installer/unix-like/rho_connect_install_constants.rb +2 -2
  123. data/installer/unix-like/rho_connect_install_utilities.rb +1 -1
  124. data/installer/utils/constants.rb +4 -4
  125. data/js-adapters/ballroom.js +216 -0
  126. data/js-adapters/node.rb +52 -0
  127. data/js-adapters/node_channel.rb +181 -0
  128. data/js-adapters/request.js +27 -0
  129. data/js-adapters/response.js +57 -0
  130. data/js-adapters/rhoconnect_helpers.js +60 -0
  131. data/js-adapters/router.js +60 -0
  132. data/js-adapters/server.js +5 -0
  133. data/lib/rhoconnect/api/app/ans_login.rb +3 -3
  134. data/lib/rhoconnect/api/app/bulk_data.rb +10 -10
  135. data/lib/rhoconnect/api/app/fast_delete.rb +11 -10
  136. data/lib/rhoconnect/api/app/fast_insert.rb +11 -10
  137. data/lib/rhoconnect/api/app/fast_update.rb +11 -10
  138. data/lib/rhoconnect/api/app/login.rb +5 -5
  139. data/lib/rhoconnect/api/app/push_deletes.rb +12 -11
  140. data/lib/rhoconnect/api/app/push_objects.rb +12 -11
  141. data/lib/rhoconnect/api/app/query.rb +8 -7
  142. data/lib/rhoconnect/api/app/queue_updates.rb +98 -94
  143. data/lib/rhoconnect/api/app/search.rb +8 -7
  144. data/lib/rhoconnect/api/client/client_get_db_doc.rb +5 -5
  145. data/lib/rhoconnect/api/client/client_set_db_doc.rb +8 -8
  146. data/lib/rhoconnect/api/client/create.rb +7 -7
  147. data/lib/rhoconnect/api/client/get_client_params.rb +4 -4
  148. data/lib/rhoconnect/api/client/list_client_docs.rb +17 -17
  149. data/lib/rhoconnect/api/client/register.rb +12 -12
  150. data/lib/rhoconnect/api/client/reset.rb +5 -5
  151. data/lib/rhoconnect/api/readstate/set_refresh_time.rb +9 -9
  152. data/lib/rhoconnect/api/source/get_source_params.rb +4 -4
  153. data/lib/rhoconnect/api/source/list_sources.rb +16 -16
  154. data/lib/rhoconnect/api/source/update_source_params.rb +6 -6
  155. data/lib/rhoconnect/api/store/get_db_doc.rb +4 -4
  156. data/lib/rhoconnect/api/store/set_db_doc.rb +7 -7
  157. data/lib/rhoconnect/api/system/get_adapter.rb +4 -4
  158. data/lib/rhoconnect/api/system/get_license_info.rb +8 -8
  159. data/lib/rhoconnect/api/system/login.rb +15 -15
  160. data/lib/rhoconnect/api/system/reset.rb +11 -11
  161. data/lib/rhoconnect/api/system/save_adapter.rb +4 -4
  162. data/lib/rhoconnect/api/system/stats.rb +22 -22
  163. data/lib/rhoconnect/api/user/create_user.rb +7 -7
  164. data/lib/rhoconnect/api/user/delete_client.rb +6 -6
  165. data/lib/rhoconnect/api/user/delete_user.rb +11 -10
  166. data/lib/rhoconnect/api/user/list_clients.rb +4 -4
  167. data/lib/rhoconnect/api/user/list_source_docs.rb +10 -10
  168. data/lib/rhoconnect/api/user/list_users.rb +3 -3
  169. data/lib/rhoconnect/api/user/ping.rb +3 -3
  170. data/lib/rhoconnect/api/user/show_user.rb +3 -3
  171. data/lib/rhoconnect/api/user/update_user.rb +5 -5
  172. data/lib/rhoconnect/api/user/user_get_db_doc.rb +5 -5
  173. data/lib/rhoconnect/api/user/user_set_db_doc.rb +10 -10
  174. data/lib/rhoconnect/api_token.rb +5 -6
  175. data/lib/rhoconnect/app.rb +6 -46
  176. data/lib/rhoconnect/application/init.rb +5 -2
  177. data/lib/rhoconnect/async.rb +76 -39
  178. data/lib/rhoconnect/bulk_data/bulk_data.rb +6 -4
  179. data/lib/rhoconnect/client.rb +59 -9
  180. data/lib/rhoconnect/condition/admin_required.rb +27 -0
  181. data/lib/rhoconnect/condition/client_required.rb +50 -0
  182. data/lib/rhoconnect/condition/login_required.rb +22 -0
  183. data/lib/rhoconnect/condition/source_required.rb +49 -0
  184. data/lib/rhoconnect/condition/verbs.rb +17 -0
  185. data/lib/rhoconnect/condition/verify_success.rb +19 -0
  186. data/lib/rhoconnect/controller/app_base.rb +74 -0
  187. data/lib/rhoconnect/controller/base.rb +68 -0
  188. data/lib/rhoconnect/controller/clients_controller.rb +79 -0
  189. data/lib/rhoconnect/controller/dynamic_adapter_controller.rb +93 -0
  190. data/lib/rhoconnect/controller/js_base.rb +124 -0
  191. data/lib/rhoconnect/controller/read_state_controller.rb +22 -0
  192. data/lib/rhoconnect/controller/source_adapter_base.rb +14 -0
  193. data/lib/rhoconnect/controller/sources_controller.rb +44 -0
  194. data/lib/rhoconnect/controller/store_controller.rb +25 -0
  195. data/lib/rhoconnect/controller/system_controller.rb +67 -0
  196. data/lib/rhoconnect/controller/users_controller.rb +99 -0
  197. data/lib/rhoconnect/db_adapter.rb +1 -3
  198. data/lib/rhoconnect/document.rb +159 -50
  199. data/lib/rhoconnect/handler/authenticate/execute_methods.rb +77 -0
  200. data/lib/rhoconnect/handler/authenticate/runner.rb +49 -0
  201. data/lib/rhoconnect/handler/authenticate.rb +3 -0
  202. data/lib/rhoconnect/handler/bulk_data.rb +28 -0
  203. data/lib/rhoconnect/handler/changes/engine.rb +271 -0
  204. data/lib/rhoconnect/handler/changes/execute_methods.rb +88 -0
  205. data/lib/rhoconnect/handler/changes/pass_through_runner.rb +11 -0
  206. data/lib/rhoconnect/handler/changes/runner.rb +53 -0
  207. data/lib/rhoconnect/handler/changes.rb +31 -0
  208. data/lib/rhoconnect/handler/helpers/auth_method.rb +29 -0
  209. data/lib/rhoconnect/handler/helpers/binding.rb +18 -0
  210. data/lib/rhoconnect/handler/helpers/bulk_data.rb +53 -0
  211. data/lib/rhoconnect/handler/helpers/source_job.rb +14 -0
  212. data/lib/rhoconnect/handler/helpers.rb +4 -0
  213. data/lib/rhoconnect/handler/plugin_callbacks/execute_methods.rb +99 -0
  214. data/lib/rhoconnect/handler/plugin_callbacks/runner.rb +28 -0
  215. data/lib/rhoconnect/handler/plugin_callbacks.rb +67 -0
  216. data/lib/rhoconnect/handler/query/engine.rb +93 -0
  217. data/lib/rhoconnect/handler/query/execute_methods.rb +21 -0
  218. data/lib/rhoconnect/handler/query/pass_through_runner.rb +35 -0
  219. data/lib/rhoconnect/handler/query/runner.rb +270 -0
  220. data/lib/rhoconnect/handler/query.rb +19 -0
  221. data/lib/rhoconnect/handler/search/engine.rb +60 -0
  222. data/lib/rhoconnect/handler/search/execute_methods.rb +32 -0
  223. data/lib/rhoconnect/handler/search/pass_through_runner.rb +18 -0
  224. data/lib/rhoconnect/handler/search/runner.rb +104 -0
  225. data/lib/rhoconnect/handler/search.rb +26 -0
  226. data/lib/rhoconnect/handler/sync.rb +29 -0
  227. data/lib/rhoconnect/jobs/source_job.rb +13 -4
  228. data/lib/rhoconnect/js_adapter.rb +79 -0
  229. data/lib/rhoconnect/license.rb +10 -2
  230. data/lib/rhoconnect/middleware/current_user.rb +14 -1
  231. data/lib/rhoconnect/middleware/helpers.rb +10 -93
  232. data/lib/rhoconnect/middleware/x_domain_session_wrapper.rb +1 -1
  233. data/lib/rhoconnect/model/base.rb +229 -0
  234. data/lib/rhoconnect/model/dynamic_adapter_model.rb +90 -0
  235. data/lib/rhoconnect/model/js_base.rb +121 -0
  236. data/lib/rhoconnect/ping/android.rb +1 -1
  237. data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +7 -4
  238. data/lib/rhoconnect/read_state.rb +3 -3
  239. data/lib/rhoconnect/server.rb +159 -190
  240. data/lib/rhoconnect/source.rb +100 -11
  241. data/lib/rhoconnect/stats/record.rb +10 -10
  242. data/lib/rhoconnect/store.rb +905 -591
  243. data/lib/rhoconnect/{model.rb → store_orm.rb} +53 -115
  244. data/lib/rhoconnect/tasks.rb +18 -4
  245. data/lib/rhoconnect/test_methods.rb +30 -17
  246. data/lib/rhoconnect/user.rb +35 -17
  247. data/lib/rhoconnect/utilities.rb +1 -1
  248. data/lib/rhoconnect/version.rb +2 -2
  249. data/lib/rhoconnect/web-console/server.rb +29 -14
  250. data/lib/rhoconnect/web-console/views/home.js +10 -10
  251. data/lib/rhoconnect/web-console/views/new_ping.js +1 -1
  252. data/lib/rhoconnect.rb +120 -51
  253. data/rhoconnect.gemspec +4 -3
  254. data/spec/api/api_helper.rb +1 -6
  255. data/spec/api/app/fast_delete_spec.rb +4 -4
  256. data/spec/api/app/fast_insert_spec.rb +4 -4
  257. data/spec/api/app/fast_update_spec.rb +8 -8
  258. data/spec/api/app/push_deletes_spec.rb +2 -2
  259. data/spec/api/app/push_objects_spec.rb +5 -5
  260. data/spec/api/client/client_get_db_doc_spec.rb +6 -4
  261. data/spec/api/client/client_set_db_doc_spec.rb +3 -2
  262. data/spec/api/client/get_client_params_spec.rb +14 -0
  263. data/spec/api/client/list_client_docs_spec.rb +30 -20
  264. data/spec/api/client/reset_spec.rb +36 -0
  265. data/spec/api/source/get_source_params_spec.rb +23 -17
  266. data/spec/api/system/get_license_info_spec.rb +0 -20
  267. data/spec/api/system/login_spec.rb +8 -0
  268. data/spec/api/system/reset_spec.rb +0 -1
  269. data/spec/api/system/stats_spec.rb +5 -5
  270. data/spec/api/user/create_user_spec.rb +14 -6
  271. data/spec/api/user/delete_user_spec.rb +20 -18
  272. data/spec/api/user/list_users_spec.rb +5 -6
  273. data/spec/api/user/update_user_spec.rb +5 -4
  274. data/spec/apps/rhotestapp/config.ru +16 -1
  275. data/spec/apps/rhotestapp/controllers/js/js_sample_controller.js +23 -0
  276. data/spec/apps/rhotestapp/controllers/js/sample2_controller.js +32 -0
  277. data/spec/apps/rhotestapp/controllers/ruby/application_controller.rb +21 -0
  278. data/spec/apps/rhotestapp/controllers/ruby/sample_adapter_controller.rb +8 -0
  279. data/spec/apps/rhotestapp/models/js/js_sample.js +55 -0
  280. data/spec/apps/rhotestapp/models/js/sample2.js +25 -0
  281. data/spec/apps/rhotestapp/{sources → models/ruby}/base_adapter.rb +0 -0
  282. data/spec/apps/rhotestapp/{sources → models/ruby}/fixed_schema_adapter.rb +0 -0
  283. data/spec/apps/rhotestapp/{sources → models/ruby}/other_adapter.rb +0 -0
  284. data/spec/apps/rhotestapp/{sources → models/ruby}/sample_adapter.rb +0 -0
  285. data/spec/apps/rhotestapp/{sources → models/ruby}/simple_adapter.rb +2 -2
  286. data/spec/apps/rhotestapp/{sources → models/ruby}/sub_adapter.rb +0 -0
  287. data/spec/apps/rhotestapp/settings/settings.yml +0 -1
  288. data/spec/bulk_data/bulk_data_spec.rb +20 -5
  289. data/spec/cli/cli_spec.rb +83 -0
  290. data/spec/client_spec.rb +20 -17
  291. data/spec/client_sync_spec.rb +244 -406
  292. data/spec/controllers/js_base_spec.rb +89 -0
  293. data/spec/doc/doc_spec.rb +18 -18
  294. data/spec/document_spec.rb +29 -13
  295. data/spec/dynamic_adapter_spec.rb +6 -6
  296. data/spec/generator/generator_spec.rb +7 -4
  297. data/spec/jobs/bulk_data_job_spec.rb +14 -10
  298. data/spec/jobs/source_job_spec.rb +8 -8
  299. data/spec/license_spec.rb +5 -2
  300. data/spec/models/js_model_spec.rb +39 -0
  301. data/spec/node_spec.rb +42 -0
  302. data/spec/perf/store_perf_spec.rb +67 -12
  303. data/spec/ping/android_spec.rb +1 -1
  304. data/spec/read_state_spec.rb +1 -1
  305. data/spec/rhoconnect_spec.rb +1 -1
  306. data/spec/server/cors_spec.rb +14 -18
  307. data/spec/server/server_spec.rb +265 -88
  308. data/spec/server/stats_spec.rb +1 -1
  309. data/spec/source_adapter_spec.rb +54 -27
  310. data/spec/source_spec.rb +8 -3
  311. data/spec/source_sync_spec.rb +538 -468
  312. data/spec/spec_helper.rb +35 -4
  313. data/spec/stats/record_spec.rb +10 -10
  314. data/spec/{model_spec.rb → store_orm_spec.rb} +56 -54
  315. data/spec/store_spec.rb +159 -179
  316. data/spec/support/shared_examples.rb +36 -27
  317. data/spec/sync_states_spec.rb +40 -33
  318. data/spec/test_methods_spec.rb +18 -14
  319. data/spec/user_spec.rb +17 -30
  320. metadata +156 -52
  321. data/bench/benchapp/application.rb +0 -39
  322. data/bench/blobapp/application.rb +0 -44
  323. data/commands/rhoconnect/clean_start.rb +0 -9
  324. data/commands/rhoconnect/create_user.rb +0 -18
  325. data/commands/rhoconnect/delete_device.rb +0 -9
  326. data/commands/rhoconnect/delete_user.rb +0 -8
  327. data/commands/rhoconnect/reset.rb +0 -16
  328. data/commands/rhoconnect/reset_refresh.rb +0 -11
  329. data/generators/templates/application/application.rb +0 -43
  330. data/lib/rhoconnect/client_sync.rb +0 -434
  331. data/lib/rhoconnect/dynamic_adapter.rb +0 -91
  332. data/lib/rhoconnect/middleware/admin_user.rb +0 -23
  333. data/lib/rhoconnect/middleware/current_request.rb +0 -16
  334. data/lib/rhoconnect/middleware/login_required.rb +0 -22
  335. data/lib/rhoconnect/source_adapter.rb +0 -132
  336. data/lib/rhoconnect/source_sync.rb +0 -464
  337. data/spec/apps/rhotestapp/application.rb +0 -23
@@ -0,0 +1,200 @@
1
+ Setting Up for RhoConnect Push Service on Client Application
2
+ ===
3
+
4
+ RhoConnect Push Service is a separate process that will run on your machine and broker push messages between your RhoConnect server and registered Android and Windows Mobile/CE devices.
5
+
6
+ This chapter contains the steps you need to set up your registered Android or Windows Mobile/CE client and RhoConnect server for RhoConnect Push Service. After you perform the steps in this chapter, you will finish by performing the [client setup that is needed for all platforms](/rhoconnect/push-client-setup).
7
+
8
+ **NOTE: If you are setting up standard RhoConnect Push on Android, you do not perform the steps in this chapter. Perform the steps in [RhoConnect Push for Android setup](/rhoconnect/push-client-setup-android) instead.**
9
+
10
+ ## Setting up RhoConnect Push Service on the Server
11
+
12
+ RhoConnect v3.3 introduces the RhoConnect Push Service (RPS) which supports efficient messaging for both Android and Windows Mobile. This service can be used instead of Google GCM on Android.
13
+
14
+ The typical flow of a message using RPS:
15
+
16
+ Device RPS RhoConnect Backend App
17
+ + + + +
18
+ | | | |
19
+ | | | POST |
20
+ | | POST |/rc/v1/users/ping|
21
+ | |/instanceId |<----------------+
22
+ | |<-----------+ |
23
+ |<----------+ | |
24
+ |{"content"}| | |
25
+ | | | |
26
+ + + + +
27
+
28
+ ### Download and Install Nodejs
29
+
30
+ If you are using a Macintosh, go to the [Node.js website](http://nodejs.org/#), and download and install Node.js. (Motorola RhoMobile Suite for Windows includes Node.js in its installation.)
31
+
32
+ ### Starting the Push Service
33
+
34
+ RhoConnect Push Service is a separate process that will run on your machine and broker push messages between your RhoConnect server and registered devices.
35
+
36
+ Assuming you've installed the latest [RhoMobile Suite](http://www.motorola.com/Business/US-EN/RhoMobile%20Suite/Downloads), start redis by runing the following command:
37
+
38
+ :::term
39
+ $ rhoconnect redis-start
40
+
41
+ Now start RhoConnect push by running the following command:
42
+
43
+ :::term
44
+ $ rhoconnect-push
45
+ RhoConnect push server started...
46
+
47
+ You can also start the server with more verbose logging (see next section for more details):
48
+
49
+ :::term
50
+ $ rhoconnect-push -d 3
51
+
52
+ Next, make sure you have the following option in your RhoConnect application's `settings/settings.yml` file in the `:development:`, `:production:` and `:test:` sections:
53
+
54
+ :::yaml
55
+ :push_server: http://someappname@localhost:8675/
56
+
57
+ Where you edit `someappname` to be a shared secret name between your RhoConnect application and your mobile application.
58
+
59
+ **NOTE: This shared secret name ensures that only your RhoConnect application can send push messages to the RPS instance you started up in the previous step. Use this shared secret name in your [mobile app's 'rhoconnect_push_appname' setting](/rhoconnect/push-client-setup-rps#configuring-rhoconfigtxt).**
60
+
61
+ Now setup [push notifications](/rhoconnect/push-client-setup#configuring-a-rhodes-application-to-receive-push-with-rhoconnect-push-service) in your Android or Windows Mobile RhoElements application, then start up your RhoConnect application.
62
+
63
+ ### Configuring RhoConnect Push
64
+
65
+ You can control basic settings for RhoConnect push using command line arguments.
66
+
67
+ :::term
68
+ $ rhoconnect-push --help
69
+
70
+ Usage: rhoconnect-push [options]
71
+
72
+ Available options:
73
+ -c, --config FILE Path to configuration (config.json) file
74
+ -d, --debug LEVEL Specify server debug level: 0 (errors) - 3 (everything)
75
+ -e, --rcPort PORT Specify RhoConnect instance port
76
+ -h, --help Print this help message
77
+ -i, --rcHost HOST Host for the RhoConnect instance
78
+ -k, --keyFile FILE Path to private SSL keyfile (https only)
79
+ -p, --port Run the server on this port (defaults to 8675)
80
+ -r, --redis REDIS Redis connection string (i.e. redis://localhost:6379)
81
+ -s, --httpSecure Specify if this server is running over https or http
82
+ -t, --timeout TIMEOUT Time (in ms) before timeout is sent to client
83
+ -T, --registrationTimeout Expiration limit for client registration tokens
84
+ -v, --version Display server version
85
+
86
+ ### Configuring and Running with config.json Advanced Options
87
+
88
+ You can also configure more advanced settings in RhoConnect push by creating a config.json file.
89
+
90
+ :::json
91
+ {
92
+ "httpSecure": "n",
93
+ "devAuthHost": "localhost",
94
+ "devAuthUrl": "/rc/v1/app/ans_login",
95
+ "devAuthPort": "9292",
96
+ "userAuthHost": "localhost",
97
+ "userAuthUrl": "/rc/v1/app/ans_login",
98
+ "userAuthPort": "9292",
99
+ "appAuthHost": "localhost",
100
+ "appAuthUrl": "/rc/v1/app/ans_login",
101
+ "appAuthPort": "9292",
102
+ "ansResponseTimeout": "300000",
103
+ "ansServerPort": "8675",
104
+ "registrationTimeout": "2592000",
105
+ "clearDataBase": "n",
106
+ "socketPoolSize": 1,
107
+ "debugLevel": "3"
108
+ }
109
+
110
+ To start the server using a config.json file, run the following command.
111
+
112
+ :::term
113
+ $ rhoconnect-push -c /path/to/config.json
114
+
115
+ The JSON file has the following parameters.
116
+
117
+ * `httpSecure` - Specify whether the push server will be an https or http server (y/n).
118
+ * `devAuthHost` - RhoConnect instance used to handle device credentials.
119
+ * `devAuthUrl` - Path used on the RhoConnect instance to handle device credentials.
120
+ * `devAuthPort` - Port used on the RhoConnect instance to handle device credentials.
121
+ * `userAuthHost` - RhoConnect instance used to handle user credentials.
122
+ * `userAuthUrl` - Path used on the RhoConnect instance to handle user credentials.
123
+ * `userAuthPort` - Port used on the RhoConnect instance to handle user credentials.
124
+ * `appAuthHost` - RhoConnect instance used to handle application credentials.
125
+ * `appAuthUrl` - Path used on the RhoConnect instance to handle application credentials.
126
+ * `appAuthPort` - Port used on the RhoConnect instance to handle application credentials.
127
+ * `ansResponseTimeout` - Time (in ms) that the push server will allow a message request from the client to go without a response. Upon expiration of this time, a 204 response will be issued and the request will be considered satisfied. If this parameter is set to 0, then this time limit will not be in effect - there is no limit to how long a client request will go without a response.
128
+ * `ansServerPort` - Push server listening port
129
+ * `registrationTimeout` - Expiration limit for registration tokens (in seconds), the client-side application is automatically unregistered if there is no activity related to its token for the registrationTimeout period. Activity related to its token consists of either attempted fetches of messages on its behalf by the push client or messages sent to the push server by RhoConnect.
130
+ * `clearDataBase` - Clear the redis database containing tokens, instanceIds, etc. at the start of the push server (y/n).
131
+ * `socketPoolSize` - The maximum number of sockets the push server will use when connecting to each of the authorization servers. This essentially caps the number of http requests to each authorization server that the push server can have outstanding at any given time.
132
+ * `debugLevel` - Print additional information to console to aid in debugging:
133
+ * 0 - print only error & warning info
134
+ * 1 - print error & warning info and message for each invoked ANS operation
135
+ * 2 - reserved for future use
136
+ * 3 - print everything
137
+
138
+ ## Installing the rhoconnect-push-service Runtime Apps on the Mobile Device
139
+
140
+ To use the RhoConnect Push Service in your client application, you must install the rhoconnect-push-service runtime app(s) on your mobile device.
141
+
142
+ On the Macintosh, the rhoconnect-push-service runtime apps for Android and for Windows Mobile are located in the Motorola RhoMobile Suite installation package, in a folder called rhoconnect-push-service.
143
+
144
+ On Windows, the rhoconnect-push-service runtime apps for Android and for Windows Mobile are located in the Motorola RhoMobile Suite installation, in a directory called rhoconnect-push-service.
145
+
146
+ ### Installing Runtime Apps on Android Device
147
+
148
+ If you are using an Android device, install `rhoconnect_push_service.apk` to your device. One way to do this is to connect your Android to your computer with a USB cable and use `adb install`. You can verify that your device is connected by executing:
149
+
150
+ $ adb devices
151
+
152
+ If connected, you’ll see the device name listed. If your computer doesn’t see the device, try killing the adb process first:
153
+
154
+ $ adb kill-server
155
+
156
+ Then navigate to the directory containing the runtime file and run `adb install`.
157
+
158
+ $ adb install <filename>.apk
159
+
160
+ ### Installing Runtime Apps for Windows Mobile/CE Devices
161
+
162
+ If you are using a Windows Mobile or CE device, install the following runtime apps on your device.
163
+
164
+ * `rhoconnect-push-service.CAB`
165
+ * `NETCFv35.Messages.EN.wm.cab`
166
+ * `NETCFv35.Messages.EN.cab`
167
+
168
+ Connect your device to your Windows computer. You can use USB-cable, bluetooth or any other method. Start ActiveSync or Windows Mobile Device Center.
169
+
170
+ Manually copy the .cab files to the device. For example, you can use the device File Explorer to display the .cab files that are on the computer. Click on each .cab file and the installation process will be started; after it is finished, you should see the app icon on your device in Programs.
171
+
172
+ ## Setting up the Rhodes Client for RhoConnect Push Service
173
+
174
+ To set up your Rhodes client application for RhoConnect Push Service, you configure rhoconfig.txt and build.yml.
175
+
176
+ ### Configuring rhoconfig.txt
177
+
178
+ In your client application `rhoconfig.txt` file, set the following options to configure your RhoConnect Push Service.
179
+
180
+ syncserver = 'http://<hostname>:<port>/application'
181
+ rhoconnect_push_server = 'http://<hostname>:<port>'
182
+ rhoconnect_push_appname = 'someappname'
183
+
184
+ Next, your RhoConnect application should be running on a network that is accessible to your device. For example, you might have your RhoConnect application running on a LAN with IP 192.168.1.10, PORT 9292. Then make sure your device is connected to the same LAN.
185
+
186
+ Here is an example of setting `rhoconfig.txt` for the RhoConnect Push Service. The URLs used for the RhoConnect Push Service (rhoconnect_push_server) and the RhoConnect server are running on the same host.
187
+
188
+ syncserver = 'http://192.168.1.10:9292/application'
189
+ rhoconnect_push_server = 'http://192.168.1.10:8675'
190
+ rhoconnect_push_appname = 'someappname'
191
+
192
+ ### Configuring build.yml
193
+
194
+ When you configure your application `build.yml` file for RhoConnect Push Service, do not add `push` under `capabilities`. Instead, add rhoconnect-push to extensions.
195
+
196
+ extensions: ["rhoconnect-push"]
197
+
198
+ ## Finishing Client Setup
199
+
200
+ Once you have completed the above steps for setting up for RhoConnect Push Service on Android or Windows Mobile/CE client and RhoConnect server, you must still [perform the client setup that is needed for all platforms](/rhoconnect/push-client-setup).
@@ -1,18 +1,22 @@
1
1
  Setting Up for RhoConnect Push on Client Application
2
2
  ===
3
3
 
4
- Push notification support (receiving push notifications from the RhoConnect server/backend) is currently available for Android, Blackberry and iPhone.
4
+ This chapter contains the final steps for setting up your Rhodes application for RhoConnect Push. You also need to perform the setup on client and server for your mobile device platform (if you have not done so already).
5
5
 
6
- ## Configuring a Rhodes Application to Receive Push
6
+ * [Setup for RhoConnect Push Service on client and server](/rhoconnect/push-client-setup-rps).
7
+ * [Setup for RhoConnect Push on client and server for Rhodes Android Client](/rhoconnect/push-client-setup-android).
8
+ * [Setup for RhoConnect Push on client and server for Rhodes Blackberry Client](/rhoconnect/push-client-setup-bb).
9
+ * [Setup for RhoConnect Push on client and server for Rhodes iOS Client](/rhoconnect/push-client-setup-ios).
7
10
 
8
- Enable push in your rhodes application in build.yml.
11
+ ## Configuring a Rhodes Application for RhoConnect Push
12
+
13
+ If you want your device to vibrate when it receives a push message, enable vibration in your Rhodes/RhoElements application in build.yml.
9
14
 
10
15
  :::yaml
11
16
  capabilities:
12
- - push
13
17
  - vibrate #=> if you want to enable vibrate in your push messages
14
18
 
15
- Set up your application [rhoconfig.txt](configuration#run-time-configuration) syncserver to point to your RhoConnect server:
19
+ Set up your application [rhoconfig.txt](/rhodes/configuration#run-time-configuration) syncserver to point to your RhoConnect server:
16
20
 
17
21
  syncserver = 'http://<rhoconnect_server_url>/application'
18
22
 
@@ -39,6 +43,15 @@ To have your Rhodes app automatically perform the operations listed in the push
39
43
  "rho_push"
40
44
  end
41
45
 
46
+ To get push messages from RhoConnect server, the user must be logged into the RhoConnect server.
47
+
48
+ In application.rb:
49
+
50
+ :::ruby
51
+ if SyncEngine::logged_in > 0
52
+ System.set_push_notification("/app/Settings/your_rhoconnect_callback",'')
53
+ end
54
+
42
55
  ## Understanding the Rhodes Push Message Payload
43
56
 
44
57
  From Rhodes 2.0.4 on, the callback push message parameters are in the form of a hash. This hash contains parameters and values for the operation to perform. If the parameter for that operation is not listed, the operation is not performed.
@@ -48,84 +61,68 @@ The hash payload may include the parameters of alert, do_sync, sound, and vibrat
48
61
  :::text
49
62
  alert=some message here&sound=alert.mp3&vibrate=2000&do_sync=product,customer
50
63
 
51
- To sync all the sources with do_sync, the source name list would specified as 'all' in the ping call, instead of 'product,customer' as in this example.
52
-
53
- The sound file should be included in the Rhodes application bundle in the `/public/alerts` folder.
54
-
55
- ## Setting up the Rhodes Client for iPhone, Android, and Blackberry
56
-
57
- To set up your Rhodes client for push, refer to these links for your respective platforms.
58
-
59
- * [Setting up iPhone Client for Push](/rhodes/device-caps#iphone-push-setup)
60
- * [Setting up Android Client for Push](/rhodes/device-caps#android-push-setup)
61
- * [Setting up Blackberry Client for Push](/rhodes/device-caps#blackberry-push-setup)
62
-
63
- ## Configuring a Rhodes Application to Receive Push with RhoConnect Push Service
64
-
65
- RhoConnect Push Service is a separate process that will run on your machine and broker push messages between your RhoConnect server and registered Android and Windows Mobile/CE devices.
66
-
67
- NOTE: You do not perform the setup steps in the Rhodes Device Capabilities chapter when you use the RhoConnect Server Push Service. That setup is for regular RhoConnect push, not for the RhoConnect Server Push Service.
64
+ To sync all the sources with do_sync, the source name list would be specified as 'all' in the ping call, instead of 'product,customer' as in this example.
68
65
 
69
- ### Installing the rhoconnect-push-service Runtime Apps
66
+ The Rhodes push payload allows more than one operation in a single message.
67
+
68
+ There are no required operations. There are default operations - if operation is not specified, no default operation will be performed.
70
69
 
71
- To use the RhoConnect Push Service in your client application, you must install the rhoconnect-push-service runtime app(s) on your mobile device.
70
+ Payload may include following operations which client will perform when it receives the PUSH message:
72
71
 
73
- On the Macintosh, the rhoconnect-push-service runtime apps for Android and for Windows Mobile are located in the Motorola RhoMobile Suite installation package, in a folder called rhoconnect-push-service.
72
+ do_sync - do sync on spec specified sync source; use "all" to sync all sources
73
+ :::ruby
74
+ # one or more sources, or "all" can be specified
75
+ do_sync = "Product,Customer"
74
76
 
75
- On Windows, the rhoconnect-push-service runtime apps for Android and for Windows Mobile are located in the Motorola RhoMobile Suite installation, in a directory called rhoconnect-push-service.
77
+ alert - bring app upfront and show specified message
78
+ :::ruby
79
+ alert = "Some message"
76
80
 
77
- If you are using an Android device, install `rhoconnect_push_service.apk` to your device.
81
+ vibrate - vibrate for the specified number of milliseconds, up to 25500; if 0 or no duration is specified, it will vibrate for 2500 millisecond.
78
82
 
79
- If you are using a Windows Mobile or CE device, install the following runtime apps on your device.
83
+ To enable vibrate in your rhodes application in build.yml:
80
84
 
81
- * `rhoconnect-push-service.CAB`
82
- * `NETCFv35.Messages.EN.wm.cab`
83
- * `NETCFv35.Messages.EN.cab`
84
-
85
- ### Configuring rhoconfig.txt
86
-
87
- In your client application `rhoconfig.txt` file, set the following options to configure your RhoConnect Push Service.
88
-
89
- syncserver = 'http://<hostname>:<port>/application'
90
- rhoconnect_push_server = 'http://<hostname>:<port>'
91
- rhoconnect_push_appname = 'someappname'
92
-
93
- Next, your RhoConnect application should be running on a network that is accessible to your device. For example, you might have your RhoConnect application running on a LAN with IP 192.168.1.10, PORT 9292. Then make sure your device is connected to the same LAN and set up your application rhoconfig.txt syncserver as follows:
94
-
95
- Here is an example of setting `rhoconfig.txt` for the RhoConnect Push Service. The URLs used for the RhoConnect Push Service (rhoconnect_push_server) and the RhoConnect server running on the same host.
96
-
97
- syncserver = 'http://192.168.1.10:9292/application'
98
- rhoconnect_push_server = 'http://192.168.1.10:8675'
99
- rhoconnect_push_appname = 'someappname'
100
-
101
- ### Configuring build.yml
85
+ capabilities:
86
+ - vibrate
87
+
88
+ Example of vibrate call:
89
+
90
+ vibrate = 2000 #=> duration in milliseconds
102
91
 
103
- When you configure your application `build.yml` file for RhoConnect Server Push Service, you do not add `push` under `capabilities` for RhoConnect Server Push Service. Instead, you add rhoconnect-push to extensions.
92
+ sound - play specified file if media type supported by the phone. iPhone will ignore media-type parameter.
93
+ :::ruby
94
+ sound = "hello.mp3"
104
95
 
105
- extensions: ["rhoconnect-push"]
96
+ The sound file should be included to the application bundle in `/public/alerts` folder.
106
97
 
107
- You can still enable vibrate in `build.yml` capabilities.
98
+ Media type should be either specified explicitly or may be recognized from file extension. Known file extensions are: .mp3 - audio/mpeg; .wav - audio/x-wav.
108
99
 
109
- capabilities:
110
- - vibrate #=> if you want to enable vibrate in your push messages
100
+ ## Handling Push Notifications from a non-RhoConnect Application
111
101
 
112
- ### Registering a Push Callback in your Client Application with RhoConnect Server Push Service
102
+ Rhodes applications can also handle PUSH notifications that didn't come from a RhoConnect application.
113
103
 
114
- To handle a RhoConnect Server Push Service push message from your Rhodes/RhoElements application, you must register callback with the set_push_notification method.
104
+ In this example, we will get the device ID so we can register the device with some push server:
105
+ :::ruby
106
+ System.get_property('device_id')
115
107
 
116
- To get push messages from RhoConnect server, the user must be logged into the RhoConnect server.
108
+ Application can set push callback to process any commands from server:
109
+ :::ruby
110
+ System.set_push_notification("/app/Settings/push_notify", '')
117
111
 
118
- In application.rb:
112
+ Callback parameters:
119
113
 
120
- :::ruby
121
- if SyncEngine::logged_in > 0
122
- System.set_push_notification("/app/Settings/your_rhoconnect_callback",'')
123
- end
114
+ * since Rhodes 2.0.4 : contain push message parameters as hash
115
+ * rhodes < 2.0.4 : message - contain server push message body
124
116
 
125
- [Understanding the Rhodes Push Message Payload](/rhoconnect/push-client-setup#understanding-the-rhodes-push-message-payload) shows the structure of the hash for the callback push message. You can write the push callback to automatically perform some of the operations in the hash by using "rho_push", as shown in [Registering a Push Callback in the Rhodes Application](/rhoconnect/push-client-setup#registering-a-push-callback-in-the-rhodes-application).
117
+ Callback return:
126
118
 
127
- ### Push Callback, Push Payload
119
+ * empty string - do not run Rhodes push command processing
120
+ * "rho_push" - to run rhodes push command processing (for alerts, sounds, etc...)
128
121
 
129
- Refer to [Rhodes Device Capabilities - Push Notifications - Push Callback](/rhodes/device-caps#push-callback) for more information about setting up a push callback.
122
+ Example:
123
+ :::ruby
124
+ def push_notify
125
+ puts 'push_notify: ' + @params.inspect
126
+ "rho_push"
127
+ end
130
128
 
131
- Refer to [Rhodes Device Capabilities - Push Notifications - Push Payload](/rhodes/device-caps#push-payload) for more information about setting up the push payload.
@@ -1,7 +1,10 @@
1
1
  Setting Up Push on RhoConnect Server
2
2
  ===
3
3
 
4
- To set up your RhoConnect server application for delivering push messages, you need to set up the application settings configurations for the operating system of your mobile client.
4
+ To set up your RhoConnect server application for delivering push messages, you need to either:
5
+
6
+ * set up to deliver push messages in your RhoConnect server application settings for the operating system of your mobile client,
7
+ * or set up the RhoConnect Push Service to broker push messages between your RhoConnect server and your mobile client.
5
8
 
6
9
  ## Setting up RhoConnect Server Push for iOS
7
10
 
@@ -53,8 +56,6 @@ Update `settings/settings.yml` to include your GCM API key:
53
56
  :licensefile: settings/license.key
54
57
  :gcm_api_key: your_gcm_api_key_here
55
58
 
56
- Start up your RhoConnect application and setup [push notifications](/rhodes/device-caps#push-notifications) in your Rhodes application.
57
-
58
59
  ## Setting up RhoConnect Server Push for Android (C2DM)
59
60
 
60
61
  **NOTE: Google has officially deprecated the C2DM service and requires that you now use Google Cloud Messaging (GCM). Please see [Google's announcement](https://developers.google.com/android/c2dm/) for more details. Follow the instructions at [Setting up RhoConnect Server Push for Android (GCM)](/rhoconnect/push-server-setup#setting-up-rhoconnect-server-push-for-android-gcm) to set up your RhoConnect Application for GCM push.**
@@ -75,18 +76,14 @@ For this purpose, you can specify C2DM Google account's username/password combo
75
76
  At run-time, the system will use these credentials to obtain the C2DM token and store it in the Redis for the future use.
76
77
  Once the token is expired, the system will automatically connect to the Google C2DM service to renew the token.
77
78
 
78
- Alternatively, you can use `:authtoken` setting to specify the pre-defined authentication token. This token MUST be related to the role-based google account registered for your application. See [the rhodes push instructions](/rhodes/device-caps#push-notifications) for more details. To retrieve this token, use sample script [c2dm.rb](http://github.com/rhomobile/rhodes/blob/master/bin/c2dm.rb). Uncomment last two lines and put your google account specific data, then run it. It will print token to stdout.
79
+ Alternatively, you can use `:authtoken` setting to specify the pre-defined authentication token. This token MUST be related to the role-based google account registered for your application. See [the Rhodes client push instructions](/rhoconnect/push-client-setup-android#setting-up-the-rhodes-client-for-android-c2dm) for more details. To retrieve this token, use sample script [c2dm.rb](http://github.com/rhomobile/rhodes/blob/master/bin/c2dm.rb). Uncomment last two lines and put your google account specific data, then run it. It will print token to stdout.
79
80
  However, this approach will not allow the server to connect to the C2DM service and renew the token once it is expired.
80
81
 
81
82
  For those who interested in what this token means, the description is [here](http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html).
82
83
 
83
- Now start up your RhoConnect application and setup [push notifications](/rhodes/device-caps#push-notifications) in your Rhodes application.
84
-
85
- ## Setting up RhoConnect Server Push Service
86
-
87
- **NOTE: This option is still a _beta_ feature. You may encounter issues using this service.**
84
+ ## Setting up RhoConnect Push Service
88
85
 
89
- RhoConnect v3.3 introduces the RhoConnect Push Service (RPS) which supports efficient messaging for both Android and Windows Mobile. This service can be used instead of Google C2DM on Android.
86
+ RhoConnect v3.3 introduces the RhoConnect Push Service (RPS) which supports efficient messaging for both Android and Windows Mobile. This service can be used instead of Google GCM or C2DM on Android.
90
87
 
91
88
  The typical flow of a message using RPS:
92
89
 
@@ -110,7 +107,59 @@ If you are using a Macintosh, go to the [Node.js website](http://nodejs.org/#),
110
107
 
111
108
  RhoConnect Push Service is a separate process that will run on your machine and broker push messages between your RhoConnect server and registered devices.
112
109
 
113
- First, create a file called "config.json" with the following content:
110
+ Assuming you've installed the latest [RhoMobile Suite](http://www.motorola.com/Business/US-EN/RhoMobile%20Suite/Downloads), start redis by runing the following command:
111
+
112
+ :::term
113
+ $ rhoconnect redis-start
114
+
115
+ Now start RhoConnect push by running the following command:
116
+
117
+ :::term
118
+ $ rhoconnect-push
119
+ RhoConnect push server started...
120
+
121
+ You can also start the server with more verbose logging (see next section for more details):
122
+
123
+ :::term
124
+ $ rhoconnect-push -d 3
125
+
126
+ Next, make sure you have the following option in your RhoConnect application's `settings/settings.yml` file in the `:development:`, `:production:` and `:test:` sections:
127
+
128
+ :::yaml
129
+ :push_server: http://someappname@localhost:8675/
130
+
131
+ Where you edit `someappname` to be a shared secret name between your RhoConnect application and your mobile application.
132
+
133
+ **NOTE: This shared secret name ensures that only your RhoConnect application can send push messages to the RPS instance you started up in the previous step. Use this shared secret name in your [mobile app's 'rhoconnect_push_appname' setting](/rhoconnect/push-client-setup-rps#configuring-rhoconfigtxt).**
134
+
135
+ Now setup [push notifications](/rhoconnect/push-client-setup#configuring-a-rhodes-application-to-receive-push-with-rhoconnect-push-service) in your Android or Windows Mobile RhoElements application, then start up your RhoConnect application.
136
+
137
+ #### Configuring RhoConnect Push
138
+
139
+ You can control basic settings for RhoConnect push using command line arguments.
140
+
141
+ :::term
142
+ $ rhoconnect-push --help
143
+
144
+ Usage: rhoconnect-push [options]
145
+
146
+ Available options:
147
+ -c, --config FILE Path to configuration (config.json) file
148
+ -d, --debug LEVEL Specify server debug level: 0 (errors) - 3 (everything)
149
+ -e, --rcPort PORT Specify RhoConnect instance port
150
+ -h, --help Print this help message
151
+ -i, --rcHost HOST Host for the RhoConnect instance
152
+ -k, --keyFile FILE Path to private SSL keyfile (https only)
153
+ -p, --port Run the server on this port (defaults to 8675)
154
+ -r, --redis REDIS Redis connection string (i.e. redis://localhost:6379)
155
+ -s, --httpSecure Specify if this server is running over https or http
156
+ -t, --timeout TIMEOUT Time (in ms) before timeout is sent to client
157
+ -T, --registrationTimeout Expiration limit for client registration tokens
158
+ -v, --version Display server version
159
+
160
+ #### Configuring and Running with config.json Advanced Options
161
+
162
+ You can also configure more advanced settings in RhoConnect push by creating a config.json file.
114
163
 
115
164
  :::json
116
165
  {
@@ -132,6 +181,11 @@ First, create a file called "config.json" with the following content:
132
181
  "debugLevel": "3"
133
182
  }
134
183
 
184
+ To start the server using a config.json file, run the following command.
185
+
186
+ :::term
187
+ $ rhoconnect-push -c /path/to/config.json
188
+
135
189
  The JSON file has the following parameters.
136
190
 
137
191
  * `httpSecure` - Specify whether the push server will be an https or http server (y/n).
@@ -155,33 +209,6 @@ The JSON file has the following parameters.
155
209
  * 2 - reserved for future use
156
210
  * 3 - print everything
157
211
 
158
-
159
- Assuming you've installed the latest [RhoMobile Suite](http://www.motorola.com/Business/US-EN/RhoMobile%20Suite/Downloads), start redis.
160
-
161
- :::term
162
- $ rhoconnect redis-start
163
-
164
- Now start RhoConnect Push by running the following in a command line:
165
-
166
- :::term
167
- $ rhoconnect-push -c /path/to/your/config.json
168
-
169
- For example:
170
-
171
- :::term
172
- $ rhoconnect-push -c C:/dev/config.json
173
-
174
- Next, make sure you have the following option in your RhoConnect application's `settings/settings.yml` file in the `:development:`, `:production:` and `:test:` sections:
175
-
176
- :::yaml
177
- :push_server: http://someappname@localhost:8675/
178
-
179
- Where `someappname` is a shared secret between your RhoConnect application and your mobile application.
180
-
181
- **NOTE: This ensures that only your RhoConnect application can send push messages to the RPS instance you started up in the previous step. Use this in your [mobile app's 'rhoconnect_push_appname' setting](/rhoconnect/push-client-setup#configuring-a-rhodes-application-to-receive-push-with-rhoconnect-push-service). **
182
-
183
- Now setup [push notifications](/rhoconnect/push-client-setup#configuring-a-rhodes-application-to-receive-push-with-rhoconnect-push-service) in your Android or Windows Mobile RhoElements application, then start up your RhoConnect application.
184
-
185
212
  ## Testing Push in the RhoConnect Web Console
186
213
 
187
214
  The [RhoConnect Web Console](/rhoconnect/web-console) includes a utility for testing push to make sure everything is wired up correctly.
@@ -194,13 +221,13 @@ Next, once you've logged into the web console, navigate to the user's page you u
194
221
 
195
222
  You should see a registered device for this user, for example: "c92e36874bc74f39a8fbd7c1a86f9e0e". Click on the link for this device and you will see the device attributes:
196
223
 
197
- device_type: APPLE
224
+ device_type: APPLE
198
225
  device_pin: 10fd92abfa8ee48155d9af6e7329086322b323fd0d18fdbd19e92d03c0fef7c8
199
226
  device_port: 100
200
227
  user_id: t
201
228
  app_id: application
202
229
 
203
- **NOTE: If you don't see all of these attributes, then something is incorrect in your Rhodes application settings. Please verify you followed the [Rhodes application push setup](/rhodes/device-caps#push-notifications).**
230
+ **NOTE: If you don't see all of these attributes, then something is incorrect in your Rhodes application settings. Please verify you followed the [Rhodes application push setup](/rhoconnect/push-client-setup).**
204
231
 
205
232
  Now that the device is registered, go back to the user page and click 'Ping User'.
206
233
 
@@ -0,0 +1,29 @@
1
+ Testing Push in the RhoConnect Web Console
2
+ ===
3
+
4
+ The [RhoConnect Web Console](/rhoconnect/web-console) includes a utility for testing push to make sure everything is wired up correctly.
5
+
6
+ First, make sure you've logged in and performed a sync on the device/simulator you are going to test.
7
+
8
+ Next, once you've logged into the web console, navigate to the user's page you used to login in the Rhodes application. For example, if you logged in as user 't', the url would be:
9
+
10
+ http://localhost:9292/console/user?user_id=t
11
+
12
+ You should see a registered device for this user, for example: "c92e36874bc74f39a8fbd7c1a86f9e0e". Click on the link for this device and you will see the device attributes:
13
+
14
+ device_type: APPLE
15
+ device_pin: 10fd92abfa8ee48155d9af6e7329086322b323fd0d18fdbd19e92d03c0fef7c8
16
+ device_port: 100
17
+ user_id: t
18
+ app_id: application
19
+
20
+ **NOTE: If you don't see all of these attributes, then something is incorrect in your Rhodes application settings. Please verify you followed the [Rhodes application push setup](/rhoconnect/push-client-setup).**
21
+
22
+ Now that the device is registered, go back to the user page and click 'Ping User'.
23
+
24
+ Here you can specify an alert message, sources array to sync, badge value (iOS only), sound file to play, and duration to vibrate.
25
+
26
+ Enter in some values or try the defaults, you should see a push message on the device when you click "Ping!".
27
+
28
+ By default, the sources list will be a comma-separated list of your RhoConnect application's sources. This sources list will be sent in the push message to trigger a sync. You can specify one or more sources, or 'all' to trigger a sync of all sources.
29
+
data/doc/push.txt CHANGED
@@ -3,12 +3,27 @@ Push Synchronization
3
3
 
4
4
  Use push synchronization when you want to automatically detect changes on the RhoConnect side, and you want to push those changes to your client without having to tell your client to sync.
5
5
 
6
- RhoConnect has a simple ruby API for sending push notifications (a ping call) to a user's devices. This API can be called directly, queued as a resque job, or called remotely via the [RhoConnect REST API](/rhoconnect/rest-api). The push message can trigger the following actions in the rhodes application: alert with a message, sync one or more sources, vibrate, display a badge, and play a sound file.
6
+ RhoConnect has a simple ruby API for sending push notifications (a ping call) to a user's devices. This API can be called directly, queued as a resque job, or called remotely via the [RhoConnect REST API](/rhoconnect/rest-api). The push message can trigger the following actions in the Rhodes application: alert with a message, sync one or more sources, vibrate, display a badge, and play a sound file.
7
7
 
8
- The following sections show how to use the RhoConnect application to deliver push messages on each platform and how you can handle the push notification in your Rhodes application.
8
+ The following sections show how to use the RhoConnect application to deliver push messages to each client platform and how you can handle the push notification in your Rhodes application.
9
+
10
+ ## Setting up Server and Client
11
+
12
+ You will need to perform one of the following set of instructions on the RhoConnect server and your mobile device for your specific platform.
13
+
14
+ * [Set up RhoConnect Push Service on client and server](/rhoconnect/push-client-setup-rps).
15
+ * [Set up RhoConnect Push on client and server for Rhodes Android Client](/rhoconnect/push-client-setup-android).
16
+ * [Set up RhoConnect Push on client and server for Rhodes Blackberry Client](/rhoconnect/push-client-setup-bb).
17
+ * [Set up RhoConnect Push on client and server for Rhodes iOS Client](/rhoconnect/push-client-setup-ios).
18
+
19
+ Then you will need to [perform the final set up on your client](/rhoconnect/push-client-setup).
20
+
21
+ ## Executing a Ping Call
22
+
23
+ RhoConnect has a simple ruby API for sending push notifications (a ping call) to a user's devices. You can [execute a ping call from your RhoConnect source adapter or from your backend application that uses a RhoConnect plugin](/rhoconnect/push-backend-setup).
24
+
25
+ ## Testing Push
26
+
27
+ You can [test push from the RhoConnect console](/rhoconnect/push-testing).
9
28
 
10
- You will need to perform the following tasks.
11
29
 
12
- * [Set up the configuration settings in the RhoConnect application](/rhoconnect/push-server-setup) for your mobile client operating system.
13
- * [Execute a ping call](/rhoconnect/push-backend-setup) from your RhoConnect source adapter or from your backend application that uses a RhoConnect plugin.
14
- * [Set up push notification support](/rhoconnect/push-client-setup) -- receiving push notifications from the RhoConnect server/backend -- on your Android, Blackberry, or iPhone client application.