{"id":216713,"date":"2014-03-22T13:52:03","date_gmt":"2014-03-22T09:52:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=216713"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=216713","title":{"rendered":"<span class=\"post_title\">Long Polling \u0434\u043b\u044f Android<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 <a href=\"http:\/\/habrahabr.ru\/company\/cackle\/blog\/167895\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0441\u0442\u0430\u043b \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0432 web \u043f\u0440\u043e\u0435\u043a\u0442\u044b Long Polling. \u041d\u0430 nginx \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u043d\u0430 javascript \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0441\u043b\u0443\u0448\u0430\u044e\u0442 \u043a\u0430\u043d\u0430\u043b\u044b. \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435.<br \/>  \u041f\u043e\u0442\u043e\u043c \u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 web \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u0442\u0430\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 Android. \u0412\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0431\u044b \u043a\u0430\u043a \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u0442\u0430\u043a \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a Long Polling \u0443\u0436\u0435 \u0431\u044b\u043b \u0432\u043d\u0435\u0434\u0440\u0451\u043d \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c java \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0434\u043b\u044f Android.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0417\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u043d\u0430\u043b\u043e\u0433 js \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u0434 \u0447\u0430\u0441\u0442\u043d\u044b\u0439, \u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439, \u0441\u043b\u0443\u0447\u0430\u0439.<\/p>\n<h4>\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h4>\n<p>  \u0418\u0442\u0430\u043a \u043d\u0430\u0447\u043d\u0443 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<h5>Nginx<\/h5>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/wandenberg\/nginx-push-stream-module\">nginx-push-stream-module<\/a><\/p>\n<p>  \u0412 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 nginx:<\/p>\n<pre><code class=\"nginx\"># \u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 location \/channels-stats {         push_stream_channels_statistics;         push_stream_channels_path $arg_id; }  # \u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 location \/pub {         push_stream_publisher admin;         push_stream_channels_path $arg_id;         push_stream_store_messages on;    # \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0430\u0447\u043d\u0451\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b }  # \u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 location ~ ^\/lp\/(.*) {         push_stream_subscriber long-polling;         push_stream_channels_path $1;         push_stream_message_template &quot;{\\&quot;id\\&quot;:~id~,\\&quot;channel\\&quot;:\\&quot;~channel~\\&quot;,\\&quot;tag\\&quot;:\\&quot;~tag~\\&quot;,\\&quot;time\\&quot;:\\&quot;~time~\\&quot;,\\&quot;text\\&quot;:~text~}&quot;;         push_stream_longpolling_connection_ttl 30s; } <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0442\u0440\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b: \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u043f\u0440\u0438\u0451\u043c\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438.<\/p>\n<h5>PHP<\/h5>\n<p>  \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 php:<\/p>\n<pre><code class=\"php\">        \/*          * $cids - ID \u043a\u0430\u043d\u0430\u043b\u0430, \u043b\u0438\u0431\u043e \u043c\u0430\u0441\u0441\u0438\u0432, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 - ID \u043a\u0430\u043d\u0430\u043b\u0430          * $text - \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c          *\/ public static function push($cids, $text) {         $text = json_encode($text);         $c = curl_init();         $url = 'http:\/\/example.com\/pub?id=';          curl_setopt($c, CURLOPT_RETURNTRANSFER, true);         curl_setopt($c, CURLOPT_POST, true);         $results = array();         if (!is_array($cids)) {             $cids = array($cids);         }         $cids = array_unique($cids);         foreach ($cids as $v) {             curl_setopt($c, CURLOPT_URL, $url . $v);             curl_setopt($c, CURLOPT_POSTFIELDS, $text);             $results[] = curl_exec($c);         }         curl_close($c); } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043a\u0430\u043d\u0430\u043b(\u044b) \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u0412\u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 plain \u0442\u0435\u043a\u0441\u0442 \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 json, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<p>  \u0414\u043e\u043b\u0433\u043e \u043e\u0431\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u043e\u0432. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432\u0441\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c, \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u043c\u0443, \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c, \u043d\u043e \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u044b\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0442\u0440\u0451\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:  <\/p>\n<pre><code>[id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f]_[\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430]_[id \u0441\u0435\u0440\u0432\u0438\u0441\u0430] <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u0430\u043d\u0430\u043b:  <\/p>\n<pre><code>0_main_0 <\/code><\/pre>\n<p>  \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441 id=777:  <\/p>\n<pre><code>777_main_0 <\/code><\/pre>\n<p>  \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u0430\u0437\u0430 \u0441 id=777 \u0432 \u043e\u0431\u0449\u0435\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043f\u0438\u0441\u043a\u0435, \u0442\u043e:  <\/p>\n<pre><code>0_orderPriceChanged_777 <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u043e.<br \/>  \u0425\u043e\u0442\u044f \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0430\u0437\u043c\u044b\u0441\u043b\u0438\u0432, \u043f\u0440\u0438\u0448\u0451\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u043e\u0439 \u0432\u0441\u0435\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432, \u0430 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u044d\u0442\u0443 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<br \/>  \u0410 \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 act:  <\/p>\n<pre><code class=\"php\">const ACT_NEW_MESSAGE = 1; LongPolling::push($uid.&quot;_main_0&quot;, array(      &quot;act&quot; =&gt; ACT_NEW_MESSAGE,      &quot;content&quot; =&gt; &quot;Hello, user &quot;.$uid.&quot;!&quot;, )); <\/code><\/pre>\n<h4>\u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h4>\n<p>  \u041f\u0440\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0440\u043e\u0434\u0435 \u0432\u0441\u0451. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a java!<br \/>  \u041a\u043b\u0430\u0441\u0441 \u044f \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/jonasasx\/LongPolling\">gihub<\/a>.<br \/>  \u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/loopj\/android-async-http\">android-async-http<\/a>. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 jar \u0444\u0430\u0439\u043b.<\/p>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439.<br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c callback \u043e\u0431\u044a\u0435\u043a\u0442, \u0432 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 callback \u043a\u043b\u0430\u0441\u0441\u0430 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d JsonHttpResponseHandler:  <\/p>\n<pre><code class=\"java\">private final static int\tACT_NEW_ORDER\t\t\t\t= 1; private final static int\tACT_DEL_ORDER\t\t\t\t= 2; private final static int\tACT_ATTRIBUTES_CHANGED\t= 3; private final static int\tACT_MESSAGE\t\t\t\t\t= 4;  private final JsonHttpResponseHandler handler = new JsonHttpResponseHandler() { \t@Override \tpublic void onSuccess(int statusCode, Header[] headers, JSONObject response) { \t\ttry { \t\t\tJSONObject json = response.getJSONObject(&quot;text&quot;); \t\t\tswitch (json.getInt(&quot;act&quot;)) { \t\t\t\tcase ACT_NEW_ORDER: \t\t\t\t\t... \t\t\t\t\tbreak; \t\t\t\tcase ACT_DEL_ORDER: \t\t\t\t\t... \t\t\t\t\tbreak; \t\t\t\tcase ACT_ATTRIBUTES_CHANGED: \t\t\t\t\t... \t\t\t\t\tbreak; \t\t\t\tcase ACT_MESSAGE: \t\t\t\t\t... \t\t\t\t\tbreak; \t\t\t\tdefault: \t\t\t\t\tbreak; \t\t\t} \t\t} catch (JSONException e) { \t\t\te.printStackTrace(); \t\t} \t} }; <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043b\u0443\u0448\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043a\u0430\u0437\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043a\u0430\u0437\u0430, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043d\u043e\u0432\u043e\u043c \u043b\u0438\u0447\u043d\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c LongPolling \u043e\u0431\u044a\u0435\u043a\u0442 (\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043c\u044b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0432 Activity):  <\/p>\n<pre><code class=\"java\">private LongPolling lp; private int uid = 1;  @Override protected void onCreate(Bundle savedInstanceState) { \tsuper.onCreate(savedInstanceState); \tsetContentView(R.layout.activity_balance); \tlp = new LongPolling(getApplicationContext(), &quot;http:\/\/example.com\/lp\/&quot;, Integer.toString(uid) + &quot;_main_0&quot;, handler); } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 Long Polling \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Activity, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"java\">public void onResume() { \tsuper.onResume(); \tlp.connect(); }  public void onPause() { \tsuper.onPause(); \tlp.disconnect(); } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 (\u0430 \u044d\u0442\u043e \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e), \u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (Application) \u0438\u043b\u0438 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 (Service).<br \/>  \u0422\u043e\u0433\u0434\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u0435  <\/p>\n<pre><code class=\"java\">lp = new LongPolling(getApplicationContext(), &quot;http:\/\/example.com\/lp\/&quot;, Integer.toString(uid) + &quot;_main_0&quot;, handler); lp.connect(); <\/code><\/pre>\n<p>  \u0418, \u0434\u0430\u0431\u044b \u043d\u0435 \u0443\u0433\u043d\u0435\u0442\u0430\u0442\u044c \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0430\u0434\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c BroadcastReceiver \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f\/\u0438\u0441\u0447\u0435\u0437\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442:<br \/>  AndroidManifest.xml  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;manifest xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;&gt;     &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; \/&gt;     &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; \/&gt;     ...     &lt;application&gt;         ...         &lt;receiver android:name=&quot;com.app.example.receivers.InternetStateReceiver&quot; &gt;             &lt;intent-filter&gt;                 &lt;action android:name=&quot;android.net.conn.CONNECTIVITY_CHANGE&quot; \/&gt;                 &lt;action android:name=&quot;android.net.wifi.supplicant.CONNECTION_CHANGE&quot; \/&gt;             &lt;\/intent-filter&gt;         &lt;\/receiver&gt;     &lt;\/application&gt; &lt;\/manifest&gt; <\/code><\/pre>\n<p>  \u0438 InternetStateReceiver  <\/p>\n<pre><code class=\"java\">public class InternetStateReceiver extends BroadcastReceiver { \tpublic void onReceive(Context context, Intent intent) { \t\tfinal ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); \t\tfinal android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); \t\tfinal android.net.NetworkInfo mobile = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); \t\tif (wifi != null && wifi.isAvailable() || mobile != null && mobile.isAvailable()) { \t\t\tapplication.getInstance().lp.connect(); \t\t} else { \t\t\tapplication.getInstance().lp.connect(); \t\t} \t} } <\/code><\/pre>\n<h4>\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430<\/h4>\n<p>  \u041d\u0443 \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u044e\u0448\u043a\u0438, \u0431\u044b\u043b\u043e \u0431 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0431\u043b\u0430\u0433\u043e \u043c\u044b \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u044d\u0442\u043e.<br \/>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u043d\u043b\u0430\u0439\u043d.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c XML\/json \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e url:  <\/p>\n<pre><code class=\"nginx\">http:\/\/example.com\/channels-stats?id=ALL<\/code><\/pre>\n<p>  \u0438 \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt; &lt;root&gt;   &lt;hostname&gt;example.com&lt;\/hostname&gt;   &lt;time&gt;2014-03-22T00:03:37&lt;\/time&gt;   &lt;channels&gt;2&lt;\/channels&gt;   &lt;wildcard_channels&gt;0&lt;\/wildcard_channels&gt;   &lt;uptime&gt;818530&lt;\/uptime&gt;   &lt;infos&gt; &lt;channel&gt;   &lt;name&gt;4_main_0&lt;\/name&gt;   &lt;published_messages&gt;0&lt;\/published_messages&gt;   &lt;stored_messages&gt;0&lt;\/stored_messages&gt;   &lt;subscribers&gt;1&lt;\/subscribers&gt; &lt;\/channel&gt; &lt;channel&gt;   &lt;name&gt;23_main_0&lt;\/name&gt;   &lt;published_messages&gt;0&lt;\/published_messages&gt;   &lt;stored_messages&gt;0&lt;\/stored_messages&gt;   &lt;subscribers&gt;1&lt;\/subscribers&gt; &lt;\/channel&gt;   &lt;\/infos&gt; &lt;\/root&gt; <\/code><\/pre>\n<p>  \u0412 \u0442\u0435\u0433\u0435 subscribers \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u0432\u043e\u0439 \u043a\u0430\u043d\u0430\u043b, \u043d\u0430 PHP \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u043d\u043b\u0430\u0439\u043d:  <\/p>\n<pre><code class=\"php\">const STATISTICS_URL = 'http:\/\/example.com\/channels-stats?id=ALL'; public static function getOnlineIds() {         $str = file_get_contents(self::STATISTICS_URL);         if (!$str)             return;         $json = json_decode($str);         if (empty($json -&gt; infos))             return;         $ids = array();         foreach ($json-&gt;infos as $v) {             if ($v -&gt; subscribers &gt; 0 && substr_count($v -&gt; channel, '_main_0') &gt; 0) {                 $ids[] = str_replace('_main_0', '', $v -&gt; channel);             }         }         return $ids; } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043c\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0441\u0435\u0442\u0438. \u041d\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u041d\u041e. \u0412 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0443 \u0432\u043e\u0442, \u0432\u0440\u043e\u0434\u0435, \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u044b\u043b\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440, \u0433\u0434\u0435 \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0442 JavaScript, \u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Android, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0449\u0438\u043a. \u0418 \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u043d\u043b\u0430\u0439\u043d.<\/p>\n<p>  \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u043a\u0440\u0438\u0442\u0438\u043a\u0443 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h5>\u0421\u0441\u044b\u043b\u043a\u0438<\/h5>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/jonasasx\/LongPolling\">https:\/\/github.com\/jonasasx\/LongPolling<\/a> \u2014 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b<\/li>\n<li><a href=\"https:\/\/github.com\/wandenberg\/nginx-push-stream-module\">https:\/\/github.com\/wandenberg\/nginx-push-stream-module<\/a> \u2014 nxing \u043c\u043e\u0434\u0443\u043b\u044c<\/li>\n<li><a href=\"https:\/\/github.com\/loopj\/android-async-http\">https:\/\/github.com\/loopj\/android-async-http<\/a> \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 http \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u043b\u044f Android<\/li>\n<\/ol>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/216713\/\"> http:\/\/habrahabr.ru\/post\/216713\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 <a href=\"http:\/\/habrahabr.ru\/company\/cackle\/blog\/167895\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0441\u0442\u0430\u043b \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0432 web \u043f\u0440\u043e\u0435\u043a\u0442\u044b Long Polling. \u041d\u0430 nginx \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u043d\u0430 javascript \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0441\u043b\u0443\u0448\u0430\u044e\u0442 \u043a\u0430\u043d\u0430\u043b\u044b. \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435.<br \/>  \u041f\u043e\u0442\u043e\u043c \u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 web \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u0442\u0430\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 Android. \u0412\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0431\u044b \u043a\u0430\u043a \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u0442\u0430\u043a \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a Long Polling \u0443\u0436\u0435 \u0431\u044b\u043b \u0432\u043d\u0435\u0434\u0440\u0451\u043d \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c java \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0434\u043b\u044f Android.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-216713","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/216713","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=216713"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/216713\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=216713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=216713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=216713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}