rhoconnect 3.1.2 → 3.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (248) hide show
  1. data/CHANGELOG.md +14 -2
  2. data/CREDITS +151 -10
  3. data/Gemfile +16 -5
  4. data/Gemfile.lock +58 -23
  5. data/Rakefile +70 -50
  6. data/bench/bench_runner.rb +2 -2
  7. data/bench/benchapp/Gemfile +6 -0
  8. data/bench/benchapp/Gemfile.lock +5 -0
  9. data/bench/benchapp/config.ru +2 -0
  10. data/bench/lib/bench/cli.rb +2 -0
  11. data/bench/lib/bench/distr_runner.rb +3 -2
  12. data/bench/lib/bench/runner.rb +1 -1
  13. data/bench/lib/bench.rb +10 -1
  14. data/bench/run_bench.sh +1 -1
  15. data/bench/scripts/test_query_script.rb +2 -1
  16. data/bench/spec/bench_spec_helper.rb +1 -0
  17. data/bin/rhoconnect +9 -27
  18. data/bin/rhoconnect-benchmark +10 -1
  19. data/commands/commands/dtach_commands/dtach_about.rb +6 -0
  20. data/commands/commands/dtach_commands/dtach_install.rb +30 -0
  21. data/commands/commands/redis_commands/redis_about.rb +6 -0
  22. data/commands/commands/redis_commands/redis_attach.rb +6 -0
  23. data/commands/commands/redis_commands/redis_download.rb +33 -0
  24. data/commands/commands/redis_commands/redis_install.rb +26 -0
  25. data/commands/commands/redis_commands/redis_make.rb +9 -0
  26. data/commands/commands/redis_commands/redis_restart.rb +7 -0
  27. data/commands/commands/redis_commands/redis_runner.rb +67 -0
  28. data/commands/commands/redis_commands/redis_start.rb +6 -0
  29. data/commands/commands/redis_commands/redis_startbg.rb +6 -0
  30. data/commands/commands/redis_commands/redis_stop.rb +6 -0
  31. data/commands/commands/rhoconnect/attach.rb +7 -0
  32. data/commands/commands/rhoconnect/clean_start.rb +9 -0
  33. data/commands/commands/rhoconnect/config.rb +15 -0
  34. data/commands/commands/rhoconnect/console.rb +15 -0
  35. data/commands/commands/rhoconnect/console_helper.rb +3 -0
  36. data/commands/commands/rhoconnect/create_user.rb +18 -0
  37. data/commands/commands/rhoconnect/delete_device.rb +9 -0
  38. data/commands/commands/rhoconnect/delete_user.rb +8 -0
  39. data/commands/commands/rhoconnect/flushdb.rb +14 -0
  40. data/commands/commands/rhoconnect/get_token.rb +25 -0
  41. data/commands/commands/rhoconnect/reset.rb +16 -0
  42. data/commands/commands/rhoconnect/reset_refresh.rb +11 -0
  43. data/commands/commands/rhoconnect/restart.rb +7 -0
  44. data/commands/commands/rhoconnect/secret.rb +11 -0
  45. data/commands/commands/rhoconnect/set_admin_password.rb +26 -0
  46. data/commands/commands/rhoconnect/spec.rb +15 -0
  47. data/commands/commands/rhoconnect/start.rb +18 -0
  48. data/commands/commands/rhoconnect/startbg.rb +34 -0
  49. data/commands/commands/rhoconnect/startdebug.rb +35 -0
  50. data/commands/commands/rhoconnect/stop.rb +11 -0
  51. data/commands/commands/rhoconnect/war.rb +32 -0
  52. data/commands/commands/rhoconnect/web.rb +7 -0
  53. data/commands/execute.rb +35 -0
  54. data/commands/generators/app.rb +6 -0
  55. data/commands/generators/source.rb +6 -0
  56. data/commands/utilities/dtach_installed.rb +10 -0
  57. data/doc/benchmarks-running.txt +5 -0
  58. data/doc/command-line.txt +216 -27
  59. data/doc/heroku-addon.txt +1 -1
  60. data/doc/preparing-production.txt +20 -1
  61. data/doc/public/cli.txt +191 -0
  62. data/doc/push-backend-setup.txt +148 -0
  63. data/doc/push-client-setup.txt +61 -0
  64. data/doc/push-server-setup.txt +91 -0
  65. data/doc/push.txt +8 -137
  66. data/doc/rest-api.txt +96 -0
  67. data/doc/settings.txt +1 -1
  68. data/doc/supported-platforms.txt +2 -1
  69. data/doc/tutorial.txt +6 -4
  70. data/examples/simple/Gemfile +39 -0
  71. data/examples/simple/Rakefile +7 -12
  72. data/examples/simple/config.ru +16 -31
  73. data/examples/simple/settings/settings.yml +5 -4
  74. data/examples/simple/sources/product.rb +51 -0
  75. data/generators/templates/application/Gemfile +7 -0
  76. data/generators/templates/application/Rakefile +5 -18
  77. data/generators/templates/application/config.ru +11 -19
  78. data/install.sh +24 -49
  79. data/installer/unix-like/create_texts.rb +71 -123
  80. data/installer/unix-like/post_install.sh +3 -0
  81. data/installer/unix-like/post_uninstall.sh +2 -0
  82. data/installer/unix-like/pre_install.sh +5 -3
  83. data/installer/unix-like/pre_uninstall.sh +14 -6
  84. data/installer/unix-like/rho_connect_install_checkers.rb +1 -1
  85. data/installer/unix-like/rho_connect_install_constants.rb +6 -10
  86. data/installer/unix-like/rho_connect_install_debian.rb +2 -2
  87. data/installer/unix-like/rho_connect_install_dnd.rb +2 -5
  88. data/installer/unix-like/rho_connect_install_installers.rb +15 -23
  89. data/installer/unix-like/rho_connect_install_yum.rb +2 -2
  90. data/installer/utils/constants.rb +4 -4
  91. data/installer/utils/create_sha1.rb +1 -1
  92. data/installer/utils/nix_install_test.rb +32 -31
  93. data/installer/utils/nix_installation.rake +1 -1
  94. data/installer/utils/package_upload/repos.rake +34 -30
  95. data/installer/utils/package_upload/s3_upload.rb +3 -3
  96. data/lib/rhoconnect/api/source/fast_delete.rb +10 -0
  97. data/lib/rhoconnect/api/source/fast_insert.rb +10 -0
  98. data/lib/rhoconnect/api/source/fast_update.rb +10 -0
  99. data/lib/rhoconnect/api/source/get_source_params.rb +1 -1
  100. data/lib/rhoconnect/api/source/list_sources.rb +2 -2
  101. data/lib/rhoconnect/api/source/save_adapter.rb +1 -1
  102. data/lib/rhoconnect/api/source/update_source_params.rb +6 -0
  103. data/lib/rhoconnect/async.rb +82 -0
  104. data/lib/rhoconnect/bulk_data/bulk_data.rb +5 -1
  105. data/lib/rhoconnect/client_sync.rb +18 -3
  106. data/lib/rhoconnect/console/rhoconnect_api.rb +2 -2
  107. data/lib/rhoconnect/console/server.rb +5 -32
  108. data/lib/rhoconnect/console.rb +2 -2
  109. data/lib/rhoconnect/graph_helper.rb +225 -0
  110. data/lib/rhoconnect/jobs/bulk_data_job.rb +24 -2
  111. data/lib/rhoconnect/server.rb +31 -11
  112. data/lib/rhoconnect/source.rb +10 -5
  113. data/lib/rhoconnect/source_sync.rb +32 -2
  114. data/lib/rhoconnect/tasks.rb +19 -108
  115. data/lib/rhoconnect/test_methods.rb +20 -0
  116. data/lib/rhoconnect/utilities.rb +118 -0
  117. data/lib/rhoconnect/version.rb +1 -1
  118. data/lib/rhoconnect/web-console/controllers/admins.js +245 -0
  119. data/lib/rhoconnect/web-console/models/adapter.js +53 -0
  120. data/lib/rhoconnect/web-console/models/client.js +105 -0
  121. data/lib/rhoconnect/web-console/models/doc.js +113 -0
  122. data/lib/rhoconnect/web-console/models/session.js +40 -0
  123. data/lib/rhoconnect/web-console/models/source.js +115 -0
  124. data/lib/rhoconnect/web-console/models/stats.js +84 -0
  125. data/lib/rhoconnect/web-console/models/user.js +111 -0
  126. data/lib/rhoconnect/web-console/public/backbone.js +1432 -0
  127. data/lib/rhoconnect/web-console/public/bootstrap.css +3990 -0
  128. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/excanvas.min.js +0 -0
  129. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.barRenderer.min.js +0 -0
  130. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisLabelRenderer.js +0 -0
  131. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisTickRenderer.js +0 -0
  132. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasTextRenderer.js +0 -0
  133. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.categoryAxisRenderer.min.js +0 -0
  134. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.cursor.js +0 -0
  135. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.js +0 -0
  136. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.min.js +0 -0
  137. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.pointLabels.min.js +0 -0
  138. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery-1.4.2.min.js +0 -0
  139. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.css +0 -0
  140. data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.js +0 -0
  141. data/lib/rhoconnect/web-console/public/jquery-1.7.1.min.js +154 -0
  142. data/lib/rhoconnect/web-console/public/rhoconnect-web.js +15 -0
  143. data/lib/rhoconnect/web-console/public/underscore.js +999 -0
  144. data/lib/rhoconnect/web-console/server.rb +55 -0
  145. data/lib/rhoconnect/web-console/templates/index.erb +90 -0
  146. data/lib/rhoconnect/web-console/templates/jqplot.erb +60 -0
  147. data/lib/rhoconnect/web-console/views/api_token.js +16 -0
  148. data/lib/rhoconnect/web-console/views/doc.js +63 -0
  149. data/lib/rhoconnect/web-console/views/edit_user.js +43 -0
  150. data/lib/rhoconnect/web-console/views/home.js +56 -0
  151. data/lib/rhoconnect/web-console/views/index.js +63 -0
  152. data/lib/rhoconnect/web-console/views/new_ping.js +58 -0
  153. data/lib/rhoconnect/web-console/views/new_user.js +29 -0
  154. data/lib/rhoconnect/web-console/views/server_doc.js +103 -0
  155. data/lib/rhoconnect/web-console/views/set_adapter.js +38 -0
  156. data/lib/rhoconnect/web-console/views/settings.js +53 -0
  157. data/lib/rhoconnect/web-console/views/show_device.js +56 -0
  158. data/lib/rhoconnect/web-console/views/show_user.js +38 -0
  159. data/lib/rhoconnect/web-console/views/source_docs.js +30 -0
  160. data/lib/rhoconnect/web-console/views/stats.js +69 -0
  161. data/lib/rhoconnect/web-console/views/users.js +20 -0
  162. data/lib/rhoconnect.rb +2 -1
  163. data/rhoconnect.gemspec +3 -1
  164. data/spec/api/application/rhoconnect_api_spec.rb +3 -5
  165. data/spec/api/source/fast_delete_spec.rb +27 -0
  166. data/spec/api/source/fast_insert_spec.rb +28 -0
  167. data/spec/api/source/fast_update_spec.rb +51 -0
  168. data/spec/api/source/get_source_params_spec.rb +1 -0
  169. data/spec/api/source/update_source_params_spec.rb +24 -0
  170. data/spec/async_spec.rb +19 -0
  171. data/spec/client_sync_spec.rb +19 -2
  172. data/spec/javascripts/PlayerSpec.js +58 -0
  173. data/spec/javascripts/admins_routes_spec.js +117 -0
  174. data/spec/javascripts/admins_spec.js +27 -0
  175. data/spec/javascripts/doc_view_spec.js +37 -0
  176. data/spec/javascripts/edit_user_view_spec.js +44 -0
  177. data/spec/javascripts/helpers/SpecHelper.js +9 -0
  178. data/spec/javascripts/helpers/jasmine-jquery.js +305 -0
  179. data/spec/javascripts/helpers/jasmine-sinon.js +43 -0
  180. data/spec/javascripts/helpers/sinon-1.3.2.js +3551 -0
  181. data/spec/javascripts/home_view_spec.js +39 -0
  182. data/spec/javascripts/index_view_spec.js +42 -0
  183. data/spec/javascripts/new_ping_view_spec.js +48 -0
  184. data/spec/javascripts/new_user_view_spec.js +42 -0
  185. data/spec/javascripts/server_doc_view_spec.js +39 -0
  186. data/spec/javascripts/set_adapter_view_spec.js +32 -0
  187. data/spec/javascripts/show_device_view_spec.js +41 -0
  188. data/spec/javascripts/show_user_view_spec.js +46 -0
  189. data/spec/javascripts/source_docs_view_spec.js +36 -0
  190. data/spec/javascripts/support/jasmine.yml +79 -0
  191. data/spec/javascripts/support/jasmine_config.rb +23 -0
  192. data/spec/javascripts/support/jasmine_runner.rb +32 -0
  193. data/spec/javascripts/users_view_spec.js +35 -0
  194. data/spec/jobs/bulk_data_job_spec.rb +10 -2
  195. data/spec/perf/bulk_data_perf_spec.rb +1 -0
  196. data/spec/server/server_spec.rb +3 -1
  197. data/spec/source_sync_spec.rb +14 -1
  198. data/spec/spec_helper.rb +51 -0
  199. data/spec/store_spec.rb +6 -0
  200. data/spec/test_methods_spec.rb +11 -0
  201. data/tasks/redis.rake +3 -1
  202. metadata +172 -64
  203. data/doc/contributing.txt +0 -60
  204. data/lib/rhoconnect/console/app/helpers/auth_helper.rb +0 -22
  205. data/lib/rhoconnect/console/app/helpers/extensions.rb +0 -19
  206. data/lib/rhoconnect/console/app/helpers/helpers.rb +0 -57
  207. data/lib/rhoconnect/console/app/public/ThickBox.css +0 -649
  208. data/lib/rhoconnect/console/app/public/home.css +0 -431
  209. data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
  210. data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
  211. data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
  212. data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
  213. data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
  214. data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
  215. data/lib/rhoconnect/console/app/public/main.css +0 -7
  216. data/lib/rhoconnect/console/app/public/reset.css +0 -76
  217. data/lib/rhoconnect/console/app/public/style.css +0 -2201
  218. data/lib/rhoconnect/console/app/public/text.txt +0 -0
  219. data/lib/rhoconnect/console/app/routes/adapter.rb +0 -28
  220. data/lib/rhoconnect/console/app/routes/auth.rb +0 -29
  221. data/lib/rhoconnect/console/app/routes/client.rb +0 -31
  222. data/lib/rhoconnect/console/app/routes/docs.rb +0 -145
  223. data/lib/rhoconnect/console/app/routes/heroku.rb +0 -19
  224. data/lib/rhoconnect/console/app/routes/home.rb +0 -63
  225. data/lib/rhoconnect/console/app/routes/timing.rb +0 -242
  226. data/lib/rhoconnect/console/app/routes/user.rb +0 -122
  227. data/lib/rhoconnect/console/app/views/adapter.erb +0 -16
  228. data/lib/rhoconnect/console/app/views/client.erb +0 -30
  229. data/lib/rhoconnect/console/app/views/content.erb +0 -14
  230. data/lib/rhoconnect/console/app/views/doc.erb +0 -8
  231. data/lib/rhoconnect/console/app/views/docdata.erb +0 -28
  232. data/lib/rhoconnect/console/app/views/docs.erb +0 -30
  233. data/lib/rhoconnect/console/app/views/edituser.erb +0 -13
  234. data/lib/rhoconnect/console/app/views/headermenu.erb +0 -40
  235. data/lib/rhoconnect/console/app/views/home.erb +0 -24
  236. data/lib/rhoconnect/console/app/views/index.erb +0 -58
  237. data/lib/rhoconnect/console/app/views/jqplot.erb +0 -52
  238. data/lib/rhoconnect/console/app/views/layout.erb +0 -153
  239. data/lib/rhoconnect/console/app/views/login.erb +0 -26
  240. data/lib/rhoconnect/console/app/views/newuser.erb +0 -17
  241. data/lib/rhoconnect/console/app/views/ping.erb +0 -40
  242. data/lib/rhoconnect/console/app/views/result.erb +0 -11
  243. data/lib/rhoconnect/console/app/views/rightboxlinks.erb +0 -15
  244. data/lib/rhoconnect/console/app/views/select_doc.erb +0 -17
  245. data/lib/rhoconnect/console/app/views/upload_doc.erb +0 -23
  246. data/lib/rhoconnect/console/app/views/user.erb +0 -29
  247. data/lib/rhoconnect/console/app/views/users.erb +0 -19
  248. data/lib/rhoconnect/server/views/index.erb +0 -13
@@ -0,0 +1,191 @@
1
+ Generating a RhoConnect Application
2
+ ===
3
+
4
+ You can generate a RhoConnect app with RhoStudio or with the `rhoconnect` utility command line tool.
5
+
6
+ ## Generating a RhoConnect App with RhoStudio
7
+
8
+ In RhoStudio, select File->New->Project...
9
+
10
+ The New Project window opens. Select the RhoConnect application wizard and click the Next button.
11
+
12
+ <img src="http://rhodocs.s3.amazonaws.com/rhoconnect-tutorial/new-project-rhoconnect.png"/>
13
+
14
+ Enter the name for your RhoConnect application in Project name. You may specify a specific folder for your destination where your project is stored, by default, the destination is your RhoStudio workspace folder. Then press the Finish button.
15
+
16
+ <img src="http://rhodocs.s3.amazonaws.com/rhoconnect-tutorial/rhoconnect-application-wizard.png"/>
17
+
18
+ ## Generating a RhoConnect App from the Command Line
19
+
20
+ The `rhoconnect` utility is a command line tool for generating RhoConnect applications and source adapters.
21
+
22
+ The app name is passed as a parameter. The `rhoconnect` utility will generate a directory for your application with all the necessary files to get started. We will start with running `rhoconnect help app` to see the usage:
23
+
24
+ :::term
25
+ Usage:
26
+ rhoconnect app NAME
27
+
28
+ Generates a new rhoconnect application.
29
+
30
+ For example:
31
+
32
+ :::term
33
+ $ rhoconnect app storeserver
34
+ Generating with app generator:
35
+ [ADDED] storeserver/config.ru
36
+ [ADDED] storeserver/settings/settings.yml
37
+ [ADDED] storeserver/settings/license.key
38
+ [ADDED] storeserver/application.rb
39
+ [ADDED] storeserver/Rakefile
40
+ [ADDED] storeserver/Gemfile
41
+ [ADDED] storeserver/spec/spec_helper.rb
42
+
43
+ Here's a basic rundown of each of the files that were just generated:
44
+
45
+
46
+ * **config.ru** - This is a rackup file which will load your application. RhoConnect uses the excellent [sinatra](http://www.sinatrarb.com/) web framework to run the application.
47
+ * **settings/settings.yml** - This contains settings such as your redis connection, which source adapters exist and their parameters. You can also put custom settings here.
48
+ * **settings/license.key** - The RhoConnect [license](/rhoconnect/licensing) associated with your application. The default license allows up to 10 devices to synchronize with the application.
49
+ * **application.rb** - The RhoConnect application class where you can implement authentication. You can also add other custom methods here to use in your application. This class is a singleton, so all methods should be added to the `class << self` block.
50
+ * **Rakefile** - This contains tasks that can be run from the terminal.
51
+ * **Gemfile** - This file specifies application's dependencies using [bundler](http://gembundler.com/).
52
+ * **spec/spec_helper.rb** - A helper file which loads the environment for running [specs](/rhoconnect/testing).
53
+
54
+ After generating the application, you might be asked to change directories to your application directory and run bundle install. For example, you would run these commands:
55
+
56
+ :::term
57
+ $ cd storeserver
58
+ $ bundle install
59
+
60
+ ## Rake Tasks
61
+ <span class="label label-important">As of version 4.0 of rhoconnect rake tasks will be deprecated!!</span>
62
+
63
+ Each RhoConnect application uses [rake](https://github.com/jimweirich/rake) to manage development tasks such as starting/stopping the app, starting resque workers, and running specs.
64
+
65
+ To run a RhoConnect rake task, simply type `rake the-task-to-run` in your RhoConnect application's root directory.
66
+
67
+ ### Installing DTach (Mac OS / Linux only)
68
+
69
+ If you're using MacOS / Linux, install [dtach](http://dtach.sourceforge.net/) on your path before running any of the rake tasks. [DTach](http://dtach.sourceforge.net/) is a simple utility which runs processes in a detached state so you can re-attach your console later.
70
+
71
+ :::term
72
+ $ cd storeserver
73
+ $ [sudo] rake dtach:install
74
+
75
+ ### Setup Redis
76
+
77
+ Next, you will need to setup and start a [redis](http://redis.io/) server:
78
+
79
+ :::term
80
+ $ [sudo] rake redis:install
81
+ $ rake redis:start
82
+
83
+ The server will show that it is running on the console.
84
+
85
+ ### Start the Application
86
+
87
+ Open a new console window (since the redis server is running in the previous console window). Then change directories to your rhoconnect applciation and start the application.
88
+
89
+ :::term
90
+ $ cd storeserver
91
+ $ rake rhoconnect:start
92
+
93
+ If everything went well, you should see the following in your console:
94
+
95
+ [05:47:10 PM 2011-04-19] Rhoconnect Server v3.0.0 started...
96
+
97
+ To open the web console, navigate to [http://localhost:9292/](http://localhost:9292) in your browser or run:
98
+
99
+ :::term
100
+ $ rake rhoconnect:web
101
+
102
+ ### Creating executable WAR containers (JRuby environment only)
103
+
104
+ It is possible to create Java WAR containers for your Rhoconnect application that can be deployed into the
105
+ Java App Servers (for example, JBoss). To create the executable WAR container, execute the following command in your app's root directory:
106
+
107
+ :::term
108
+ $ cd storeserver
109
+ $ rake rhoconnect:war
110
+
111
+ This will build the WAR file named <your_app>.war that can be deployed into the Java App Server.
112
+
113
+
114
+ ### Common Tasks
115
+
116
+ RhoConnect applications come with many useful rake tasks for administrative and development workflows. Some common ones are:
117
+
118
+ * `rake dtach:install` - (Mac OS / Linux only) This will install [dtach](http://dtach.sourceforge.net/) to /usr/local/bin.
119
+
120
+ * `rake redis:install` - This will install to the system. On Mac OS / Linux, it will attempt to install in '/usr/local/bin' (on windows, C:\redis-<version>), unless you have specified a REDIS_HOME to use instead.
121
+ If you cannot install redis on Linux due to insufficient user permissions, then follows these [instructions](/rhoconnect/install).
122
+
123
+ * `rake rhoconnect:set_admin_password` - Set the RhoConnect administrator password. The default password is blank ''.
124
+
125
+ * `rake rhoconnect:get_token` - Get a RhoConnect API token to use for calling the RhoConnect REST API.
126
+
127
+ **NOTE: On Mac OS / Linux, you need to install dtach (i.e. by running `rake dtach:install`) to run the following tasks: **
128
+
129
+ * `rake redis:start` - This will launch a redis server in a new console.
130
+
131
+ * `rake redis:stop` - Stop the currently-running redis server.
132
+
133
+ * `rake redis:attach` - (Mac OS / Linux only) Attach to a currently-running redis server.
134
+
135
+ * `rake rhoconnect:start` - Start the RhoConnect application in a new console. This requires a running redis server.
136
+
137
+ * `rake rhoconnect:stop` - Stop the currently-running RhoConnect application.
138
+
139
+ * `rake rhoconnect:attach` - (Mac OS / Linux only) Attach to a currently-running RhoConnect application.
140
+
141
+ * `rake rhoconnect:clean_start` - Useful for development, resets and bootstraps the RhoConnect application with a test user.
142
+
143
+ Some other useful development tasks:
144
+
145
+ * `rake rhoconnect:reset` - Reset the RhoConnect application to the initial state. This WILL DELETE ALL DATA IN REDIS! So be sure you don't run this in production!
146
+
147
+ * `rake rhoconnect:spec` - Run all source adapter specs in spec/sources/.
148
+
149
+ * `rake rhoconnect:web` - Open the RhoConnect web console in a browser.
150
+
151
+ Here is a complete list of the rake tasks available in a RhoConnect application:
152
+
153
+ :::term
154
+ $ cd storeserver
155
+ $ rake -T
156
+ (in ~/storeserver)
157
+ rake dtach:about # About dtach
158
+ rake dtach:install # Install dtach 0.8 from source
159
+ rake redis:about # About redis
160
+ rake redis:attach # Attach to redis dtach socket
161
+ rake redis:download # Download package
162
+ rake redis:install # Install the latest verison of Redis from Github (requires git, duh)
163
+ rake redis:restart # Restart redis
164
+ rake redis:start # Start redis
165
+ rake redis:stop # Stop redis
166
+ rake resque:work # Start a Resque worker
167
+ rake resque:workers # Start multiple Resque workers.
168
+ rake rhoconnect:attach # Attach to rhoconnect console
169
+ rake rhoconnect:clean_start # Clean rhoconnect, get token, and create new user
170
+ rake rhoconnect:create_user # Creates and subscribes user for application in rhoconnect
171
+ rake rhoconnect:delete_device # Deletes a device from rhoconnect
172
+ rake rhoconnect:delete_user # Deletes a user from rhoconnect
173
+ rake rhoconnect:flushdb # Flush data store - WARNING: THIS REMOVES ALL DATA IN RHOCONNECT
174
+ rake rhoconnect:get_token # Fetches current api token from rhoconnect
175
+ rake rhoconnect:reset # Reset the rhoconnect database (you will need to run rhoconnect:get_token afterwards)
176
+ rake rhoconnect:reset_refresh # Reset source refresh time
177
+ rake rhoconnect:restart # Alias for `rake rhoconnect:stop; rake rhoconnect:start`
178
+ rake rhoconnect:set_admin_password # Sets the admin password
179
+ rake rhoconnect:spec # Run source adapter specs
180
+ rake rhoconnect:start # Start rhoconnect server
181
+ rake rhoconnect:stop # Stop rhoconnect server
182
+ rake rhoconnect:war # Build executable WAR file to be used in Java App Servers
183
+ rake rhoconnect:web # Launch the web console in a browser - uses :syncserver: in settings.yml
184
+
185
+ ## Generate Source
186
+
187
+ Connecting to a backend service with RhoConnect requires that you write a small amount of code for the query, create, update and delete operations of your particular enterprise backend. The collection of the code for these operations is called a source. You can create source for your RhoConnect application two ways:
188
+
189
+ * [RhoConnect source adapter](/rhoconnect/source-adapters): generate a Ruby code source adapter from RhoStudio or from the command line, similar to how you generate a RhoConnect app. This source adapter contains code for the query, create, update and delete operations.
190
+
191
+ * [RhoConnect plugin](/rhoconnect/plugin-intro): write the source code (the query, create, update and delete operations) into your backend application, and plug a RhoConnect plugin in the application. The plugin is written in the language that matchs your backend application, such as Java or .NET.
@@ -0,0 +1,148 @@
1
+ Setting Up Push on Backend Application
2
+ ===
3
+
4
+ A RhoConnect push to the client consists of executing a RhoConnect ping call. There are three ways to execute a ping call: you can use the RhoConnect REST API to remotely call the ping, perform the ping job directly in a blocking ruby call, or enqueue a resque job to ping asynchronously.
5
+
6
+ ## Pushing Remotely with the RhoConnect REST API
7
+
8
+ You can trigger a push remotely using the [RhoConnect API Ping method](/rhoconnect/rest-api). This is useful if you want to fully control the push process from a remote server, such as when you use a RhoConnect plugin to connect your backend application to the RhoConnect server application.
9
+
10
+ **NOTE: If you want to sync all the sources, use 'all' for the source list (the soure_name parameter) instead of a comma-separated list of the RhoConnect application source names to sync.**
11
+
12
+ ### Example of Ping for Ruby Backend Application
13
+
14
+ As an example, here is how to send a PUSH message to all the devices of the specified user(s) from a Ruby backend app:
15
+
16
+ :::ruby
17
+ # :message - message which will be used to display notification popup dialog on the device
18
+ # :badge - iphone specific badge
19
+ # :sound - name of the sound file to play upon receiving PUSH notification
20
+ # :vibrate - number of seconds to vibrate upon receiving PUSH notification
21
+ # :sources - list of data source names to be synced upon receiving PUSH notification
22
+ ping_params = {
23
+ :api_token => token,
24
+ :user_id => [array_of_users],
25
+ :sources => source_name,
26
+ :message => 'hello world',
27
+ :vibrate => 2000,
28
+ :sound => 'hello.mp3'
29
+ }
30
+
31
+ RestClient.post(
32
+ "#{server}/api/client/ping",ping_params.to_json,
33
+ :content_type => :json
34
+ )
35
+
36
+ ### Example of Ping for .NET Backend Application
37
+
38
+ As an example, here is how to send a PUSH message to all the devices of the specified user(s) from a .NET backend app:
39
+
40
+ private static bool perform_ping(String method, String source_name, String the_message, String vibrate_time, String sound_file, Hashtable reqHash)
41
+ {
42
+ // add meta information
43
+ reqHash.Add("api_token", _api_token);
44
+ reqHash.Add("user_id", [array of users]); // not sure how I do this
45
+ reqHash.Add("source_id", source_name);
46
+ reqHash.Add("message", the_message);
47
+ reqHash.Add("vibrate", vibrate_time);
48
+ reqHash.Add("sound", sound_file);
49
+
50
+ JavaScriptSerializer js = new JavaScriptSerializer();
51
+ string requestBody = js.Serialize(reqHash);
52
+
53
+
54
+ // Uri address = new Uri(_endpoint_url + "/api/source/" + method);
55
+ Uri address = new Uri(_endpoint_url + "/api/client/ping");
56
+ HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
57
+ request.ContentType = "application/json";
58
+ request.Method = "POST";
59
+
60
+ byte[] byteData = UTF8Encoding.UTF8.GetBytes(requestBody);
61
+ request.ContentLength = byteData.Length;
62
+ using (Stream requestStream = request.GetRequestStream())
63
+ {
64
+ requestStream.Write(byteData, 0, byteData.Length);
65
+ }
66
+ using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
67
+ {
68
+ ;
69
+ }
70
+
71
+ return true;
72
+ }
73
+
74
+ ### Example of Ping for Java Backend Application
75
+
76
+ As an example, here is how to send a PUSH message to all the devices of the specified user(s) from a Java backend app:
77
+
78
+ :::java
79
+ private boolean performPing(String method, String sourceName, HashMap<String, Object> hash) {
80
+ hash.put("api_token", apiToken);
81
+ hash.put("source_id", sourceName);
82
+ hash.put("user_id", partition);
83
+ hash.put("message", "hello world");
84
+ hash.put("vibrate", "2000");
85
+ hash.put("sound", "hello.mp3");
86
+
87
+
88
+ HttpHeaders headers = new HttpHeaders();
89
+ headers.setContentType(MediaType.APPLICATION_JSON);
90
+ HttpEntity<Map> entity = new HttpEntity<Map>(hash, headers);
91
+
92
+ ResponseEntity<String> response = restTemplate.exchange(
93
+ endpointUrl + "/api/client/ping",
94
+ HttpMethod.POST,
95
+ entity,
96
+ String.class);
97
+ HttpStatus statusCode = response.getStatusCode();
98
+
99
+ return(statusCode.value() == 200);
100
+ }
101
+
102
+ ## Pushing Directly from a RhoConnect Source Adapter
103
+
104
+ When you use a RhoConnect source adapter to connect to your backend service, you can use the PingJob.perform method to perform a ping on your mobile client.
105
+
106
+ :::ruby
107
+ PingJob.perform(
108
+ 'user_id' => current_user.login,
109
+ 'sources' => ['Product','Customer'],
110
+ 'message' => 'hello world',
111
+ 'vibrate' => 2000,
112
+ 'sound' => 'hello.mp3'
113
+ )
114
+
115
+ Let's say we want to execute a ping for the `current_user` at the end of your RhoConnect source adapter query.
116
+
117
+ :::ruby
118
+ def query(params=nil)
119
+ parsed = JSON.parse(RestClient.get("#{@base}.json").body)
120
+
121
+ @result = {}
122
+ parsed.each do |item|
123
+ @result[item["product"]["id"].to_s] = item["product"]
124
+ end if parsed
125
+ PingJob.perform(
126
+ 'user_id' => current_user.login,
127
+ 'sources' => ['Product'],
128
+ 'message' => "There are new products!",
129
+ 'vibrate' => 2000
130
+ )
131
+ @result
132
+ end
133
+
134
+ ## Queuing a Resque Job to Push Asynchronously
135
+
136
+ To queue a ping that is executed asynchronously in a job, you can have PingJob queued from anywhere in your RhoConnect application (i.e. at the end of another job or adapter query method).
137
+
138
+ :::ruby
139
+ Resque.enqueue(
140
+ PingJob,
141
+ 'user_id' => current_user.login,
142
+ 'sources' => ['Product','Customer'],
143
+ 'message' => 'hello world',
144
+ 'vibrate' => 2000,
145
+ 'sound' => 'hello.mp3'
146
+ )
147
+
148
+ **Note: For this job to execute, you will need to have a resque worker running. See running [async jobs](/rhoconnect/async-jobs) for more information.**
@@ -0,0 +1,61 @@
1
+ Setting Up for RhoConnect Push on Client Application
2
+ ===
3
+
4
+ Push notification support (receiving push notifications from the RhoConnect server/backend) is currently available for Android, Blackberry and iPhone.
5
+
6
+ ## Configuring a Rhodes Application to Receive Push
7
+
8
+ Enable push in your rhodes application in build.yml.
9
+
10
+ :::yaml
11
+ capabilities:
12
+ - push
13
+ - vibrate #=> if you want to enable vibrate in your push messages
14
+
15
+ Set up your application [rhoconfig.txt](configuration#run-time-configuration) syncserver to point to your RhoConnect server:
16
+
17
+ syncserver = 'http://<rhoconnect_server_url>/application'
18
+
19
+ ## Registering a Push Callback in the Rhodes Application
20
+
21
+ To handle a push message from a Rhodes application, you must register push callback with the System `set_push_notification` method.
22
+
23
+ :::ruby
24
+ class AppApplication < Rho::RhoApplication
25
+ def initialize
26
+ super
27
+ System.set_push_notification "/app/Push/push_callback", ""
28
+ end
29
+ end
30
+
31
+ Push callback is set up in the form of a local application URL and called as callback whether or not rho_callback=1 is specified in its parameters list.
32
+
33
+ The parameters trigger certain operations in the Rhodes client when the callback returns "rho_push". (When the callback retuens an empty string, this automatic handling is not performed.) The operations are to show an alert, vibrate the device, play a sound, and perform a sync.
34
+
35
+ To have your Rhodes app automatically perform the operations listed in the push message, you can write the callback as follows.
36
+
37
+ :::ruby
38
+ def push_callback
39
+ "rho_push"
40
+ end
41
+
42
+ ## Understanding the Rhodes Push Message Payload
43
+
44
+ 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.
45
+
46
+ The hash payload may include the parameters of alert, do_sync, sound, and vibrate which perform operations that the client performs when it receives the PUSH message. Here is an example of a push message body with the parameter names and values. It will have a popup alert message of "some message", play a sound of alert.mp3, will vibrate the device, and will sync the product and customer sources.
47
+
48
+ :::text
49
+ alert=some message here&sound=alert.mp3&vibrate=2000&do_sync=product,customer
50
+
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)
@@ -0,0 +1,91 @@
1
+ Setting Up Push on RhoConnect Server
2
+ ===
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.
5
+
6
+ ## Setting up RhoConnect Server Push for iOS
7
+
8
+ To set up your RhoConnect application for pushing to an iOS client, you will need to update `settings/settings.yml` to include the following:
9
+
10
+ :::yaml
11
+ :development:
12
+ :redis: localhost:6379
13
+ :iphonecertfile: settings/apple_push_cert.pem
14
+ :iphonepassphrase: #=> empty or put password for your certificate
15
+ :iphoneserver: gateway.sandbox.push.apple.com
16
+ :iphoneport: 2195
17
+ :syncserver: http://localhost:9292/application/
18
+ :licensefile: settings/license.key
19
+
20
+ This is for running your application in development mode; for production, you will need all of the iphone settings, and you change the `:iphoneserver:` to:
21
+
22
+ :::yaml
23
+ :iphoneserver: gateway.push.apple.com
24
+
25
+ ## Setting up RhoConnect Server Push for Blackberry
26
+
27
+ To set up your RhoConnect application for pushing to a BlackBerry client, you will need to update `settings/settings.yml` to include the following:
28
+
29
+ :::yaml
30
+ :development:
31
+ :redis: localhost:6379
32
+ :mdsserver: 192.168.1.110
33
+ :mdsserverport: 8080
34
+ :syncserver: http://localhost:9292/application/
35
+ :licensefile: settings/license.key
36
+
37
+ Replace `:mdsserver:` and `:mdsserverport:` with the hostname/IP and port of your machine (default port is 8080).
38
+
39
+ ## Setting up RhoConnect Server Push for Android
40
+
41
+ To set up your RhoConnect application for Android push, you will need to update `settings/settings.yml` to include the following:
42
+
43
+ :::yaml
44
+ :development:
45
+ :redis: localhost:6379
46
+ :syncserver: http://localhost:9292/application/
47
+ :licensefile: settings/license.key
48
+ :c2dm_username: username
49
+ :c2dm_passwd: passwd
50
+ :authtoken: authtoken
51
+
52
+ In order to push messages to the Android device, your server needs to obtain Google's C2DM authentication token associated with the trusted google account.
53
+ For this purpose, you can specify C2DM Google account's username/password combo via the `:c2dm_username` and `:c2dm_passwd` settings.
54
+ At run-time, the system will use these credentials to obtain the C2DM token and store it in the Redis for the future use.
55
+ Once the token is expired, the system will automatically connect to the Google C2DM service to renew the token.
56
+
57
+ 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.
58
+ However, this approach will not allow the server to connect to the C2DM service and renew the token once it is expired.
59
+
60
+ For those who interested in what this token means, the description is [here](http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html).
61
+
62
+ Now start up your RhoConnect application and setup [push notifications](/rhodes/device-caps#push-notifications) in your Rhodes application.
63
+
64
+ ## Testing Push in the RhoConnect Web Console
65
+
66
+ The [RhoConnect Web Console](/rhoconnect/web-console) includes a utility for testing push to make sure everything is wired up correctly.
67
+
68
+ First, make sure you've logged in and performed a sync on the device/simulator you are going to test.
69
+
70
+ 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:
71
+
72
+ http://localhost:9292/console/user?user_id=t
73
+
74
+ 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:
75
+
76
+ device_type: APPLE
77
+ device_pin: 10fd92abfa8ee48155d9af6e7329086322b323fd0d18fdbd19e92d03c0fef7c8
78
+ device_port: 100
79
+ user_id: t
80
+ app_id: application
81
+
82
+ **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).**
83
+
84
+ Now that the device is registered, go back to the user page and click 'Ping User'.
85
+
86
+ Here you can specify an alert message, sources array to sync, badge value (iOS only), sound file to play, and duration to vibrate.
87
+
88
+ Enter in some values or try the defaults, you should see a push message on the device when you click "Ping!".
89
+
90
+ 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.
91
+
data/doc/push.txt CHANGED
@@ -1,143 +1,14 @@
1
- Device Push
1
+ Push Synchronization
2
2
  ===
3
3
 
4
- RhoConnect has a simple ruby API for sending push notifications 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, play a sound file.
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
- We will now show you 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.
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
- ## iOS
9
- To setup your RhoConnect application for iOS push, you will need to update `settings/settings.yml` to include the following:
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.
10
9
 
11
- :::yaml
12
- :development:
13
- :redis: localhost:6379
14
- :iphonecertfile: settings/apple_push_cert.pem
15
- :iphonepassphrase: #=> empty or put password for your certificate
16
- :iphoneserver: gateway.sandbox.push.apple.com
17
- :iphoneport: 2195
18
- :syncserver: http://localhost:9292/application/
19
- :licensefile: settings/license.key
10
+ You will need to perform the following tasks.
20
11
 
21
- This is for running your application in development mode, for production you will need all of the iphone settings, and change the `:iphoneserver:` to:
22
-
23
- :::yaml
24
- :iphoneserver: gateway.push.apple.com
25
-
26
- ## Blackberry
27
- To setup your RhoConnect application for BlackBerry push, you will need to update `settings/settings.yml` to include the following:
28
-
29
- :::yaml
30
- :development:
31
- :redis: localhost:6379
32
- :mdsserver: 192.168.1.110
33
- :mdsserverport: 8080
34
- :syncserver: http://localhost:9292/application/
35
- :licensefile: settings/license.key
36
-
37
- Replace `:mdsserver:` and `:mdsserverport:` with the hostname/IP and port of your machine (default port is 8080).
38
-
39
- ## Android
40
- To setup your RhoConnect application for Android push, you will need to update `settings/settings.yml` to include the following:
41
-
42
- :::yaml
43
- :development:
44
- :redis: localhost:6379
45
- :syncserver: http://localhost:9292/application/
46
- :licensefile: settings/license.key
47
- :c2dm_username: username
48
- :c2dm_passwd: passwd
49
- :authtoken: authtoken
50
-
51
- In order to push messages to the Android device, your server needs to obtain Google's C2DM authentication token associated with the trusted google account.
52
- For this purpose, you can specify C2DM Google account's username/password combo via the `:c2dm_username` and `:c2dm_passwd` settings.
53
- At run-time, the system will use these credentials to obtain the C2DM token and store it in the Redis for the future use.
54
- Once the token is expired, the system will automatically connect to the Google C2DM service to renew the token.
55
-
56
- 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.
57
- However, this approach will not allow the server to connect to the C2DM service and renew the token once it is expired.
58
-
59
- For those who interested in what this token means, the description is [here](http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html).
60
-
61
- Now start up your RhoConnect application and setup [push notifications](/rhodes/device-caps#push-notifications) in your Rhodes application.
62
-
63
- ## Testing Push in the Web Console
64
- The [RhoConnect Web Console](/rhoconnect/web-console) includes a utility for testing push to make sure everything is wired up correctly.
65
-
66
- First, make sure you've logged in and performed a sync on the device/simulator you are going to test.
67
-
68
- 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:
69
-
70
- http://localhost:9292/console/user?user_id=t
71
-
72
- 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:
73
-
74
- device_type: APPLE
75
- device_pin: 10fd92abfa8ee48155d9af6e7329086322b323fd0d18fdbd19e92d03c0fef7c8
76
- device_port: 100
77
- user_id: t
78
- app_id: application
79
-
80
- **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).**
81
-
82
- Now that the device is registered, go back to the user page and click 'Ping User'.
83
-
84
- Here you can specify an alert message, sources array to sync, badge value (iOS only), sound file to play, and duration to vibrate.
85
-
86
- Enter in some values or try the defaults, you should see a push message on the device when you click "Ping!".
87
-
88
- 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.
89
-
90
- ## Push API
91
- The RhoConnect push API consists of executing a ping call. There are three ways to execute a ping call: use RhoConnect API to remotely call the ping, perform the ping job directly in a blocking ruby call, enqueue a resque job to ping asynchronously.
92
-
93
- ### RhoConnect API Ping Method
94
- You can trigger a push remotely using the [RhoConnect API Ping method](/rhoconnect/rest-api). This is useful if you want to fully control the push process from a remote server (instead of your source adapter).
95
-
96
- ### Direct Push
97
- To perform a ping directly, you can call the following:
98
-
99
- :::ruby
100
- PingJob.perform(
101
- 'user_id' => current_user.login,
102
- 'sources' => ['Product','Customer'],
103
- 'message' => 'hello world',
104
- 'vibrate' => 2000,
105
- 'sound' => 'hello.mp3'
106
- )
107
-
108
- ### Asynchronous Push
109
- To queue a ping that is executed asynchronously in a job, you can call the following:
110
-
111
- :::ruby
112
- Resque.enqueue(
113
- PingJob,
114
- 'user_id' => current_user.login,
115
- 'sources' => ['Product','Customer'],
116
- 'message' => 'hello world',
117
- 'vibrate' => 2000,
118
- 'sound' => 'hello.mp3'
119
- )
120
-
121
- **Note: For this job to execute, you will need to have a resque worker running. See running [async jobs](/rhoconnect/async-jobs) for more information.**
122
-
123
- ### Example
124
- Let's say we want to execute a ping for the `current_user` at the end of our source adapter query:
125
-
126
- :::ruby
127
- def query(params=nil)
128
- parsed = JSON.parse(RestClient.get("#{@base}.json").body)
129
-
130
- @result = {}
131
- parsed.each do |item|
132
- @result[item["product"]["id"].to_s] = item["product"]
133
- end if parsed
134
- PingJob.perform(
135
- 'user_id' => current_user.login,
136
- 'sources' => ['Product'],
137
- 'message' => "There are new products!",
138
- 'vibrate' => 2000
139
- )
140
- end
141
-
142
- ### Push Notifications in Rhodes
143
- Now that you can send push messages in your RhoConnect application, you can now handle the [push notification](/rhodes/device-caps#push-notifications) in your Rhodes application.
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.