Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chat
RocketChatMobilePushGateway
Commits
2c055c36
Commit
2c055c36
authored
Jul 02, 2018
by
armin
Browse files
apns title
parent
125756a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
models/ApplePushModel.cpp
View file @
2c055c36
...
...
@@ -110,12 +110,25 @@ ApplePushModel::ApplePushModel(const std::string &pJson) {
bool
ApplePushModel
::
sendMessage
()
{
std
::
vector
<
std
::
string
>
tokens
;
Json
::
Value
obj
;
Json
::
FastWriter
fast
;
//tokens.push_back(mDeviceToken);
Json
::
Value
alert
;
alert
[
"body"
]
=
mText
;
alert
[
"title"
]
=
mTitle
;
Json
::
Value
aps
;
aps
[
"category"
]
=
"MESSAGE"
;
aps
[
"badge"
]
=
mBadge
;
aps
[
"sound"
]
=
mSound
;
aps
[
"alert"
]
=
alert
;
obj
[
"aps"
]
=
aps
;
obj
[
"ejson"
]
=
mPayload
;
std
::
string
json
=
fast
.
write
(
obj
);
std
::
cout
<<
json
<<
std
::
endl
;
CURL
*
curl
;
CURLcode
res
;
...
...
@@ -153,11 +166,13 @@ bool ApplePushModel::sendMessage() {
std
::
string
url
=
mApiUrl
+
mDeviceToken
;
std
::
cout
<<
url
<<
std
::
endl
;
// curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, trace );
curl_easy_setopt
(
curl
,
CURLOPT_VERBOSE
,
false
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
url
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
mPayload
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
mPayload
.
size
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
json
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
json
.
size
());
curl_easy_setopt
(
curl
,
CURLOPT_POST
,
true
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
chunk
);
curl_easy_setopt
(
curl
,
CURLOPT_USE_SSL
,
true
);
...
...
models/GooglePushModel.cpp
View file @
2c055c36
...
...
@@ -162,6 +162,7 @@ bool GooglePushModel::sendMessage() {
obj
[
"to"
]
=
mDeviceToken
;
obj
[
"data"
]
=
msg
;
obj
[
"priority"
]
=
10
;
obj
[
"collapseKey"
]
=
mFrom
;
Json
::
FastWriter
fast
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment