Skip to content
Snippets Groups Projects
Commit 374fdd6c authored by Adrien Béraud's avatar Adrien Béraud
Browse files

proxy: send normal priority push message for value expiration

parent 54b1314a
Branches
Tags
No related merge requests found
...@@ -281,7 +281,7 @@ private: ...@@ -281,7 +281,7 @@ private:
* @param key of the device * @param key of the device
* @param json, the content to send * @param json, the content to send
*/ */
void sendPushNotification(const std::string& key, Json::Value&& json, bool isAndroid); void sendPushNotification(const std::string& key, Json::Value&& json, bool isAndroid, bool highPriority);
/** /**
* Send push notification with an expire timeout. * Send push notification with an expire timeout.
......
...@@ -706,7 +706,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request, ...@@ -706,7 +706,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request,
} }
json["exp"] = ss.str(); json["exp"] = ss.str();
} }
sendPushNotification(pushToken, std::move(json), isAndroid); sendPushNotification(pushToken, std::move(json), isAndroid, !expired);
return true; return true;
} }
); );
...@@ -802,7 +802,7 @@ DhtProxyServer::handleNotifyPushListenExpire(const asio::error_code &ec, const s ...@@ -802,7 +802,7 @@ DhtProxyServer::handleNotifyPushListenExpire(const asio::error_code &ec, const s
} }
if (logger_) if (logger_)
logger_->d("[proxy:server] [subscribe] sending put refresh to %s token", pushToken.c_str()); logger_->d("[proxy:server] [subscribe] sending put refresh to %s token", pushToken.c_str());
sendPushNotification(pushToken, std::move(json), isAndroid); sendPushNotification(pushToken, std::move(json), isAndroid, false);
} }
void void
...@@ -844,7 +844,7 @@ DhtProxyServer::handleCancelPushListen(const asio::error_code &ec, const std::st ...@@ -844,7 +844,7 @@ DhtProxyServer::handleCancelPushListen(const asio::error_code &ec, const std::st
} }
void void
DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& json, bool isAndroid) DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& json, bool isAndroid, bool highPriority)
{ {
if (pushServer_.empty()) if (pushServer_.empty())
return; return;
...@@ -868,7 +868,7 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso ...@@ -868,7 +868,7 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso
notification["tokens"] = std::move(tokens); notification["tokens"] = std::move(tokens);
notification["platform"] = isAndroid ? 2 : 1; notification["platform"] = isAndroid ? 2 : 1;
notification["data"] = std::move(json); notification["data"] = std::move(json);
notification["priority"] = "high"; notification["priority"] = highPriority ? "high" : "normal";
notification["time_to_live"] = 600; notification["time_to_live"] = 600;
Json::Value notifications(Json::arrayValue); Json::Value notifications(Json::arrayValue);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment