-
Notifications
You must be signed in to change notification settings - Fork 4
/
readme.html
226 lines (190 loc) · 9.12 KB
/
readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Push Server Plugin Readme</title>
<style type="text/css">
BODY {
font-size : 100%;
}
BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em;
}
H4 {
font-size : 10pt;
font-style: italic;
}
H3 {
font-size : 10pt;
font-weight: bold;
}
H2 {
font-size : 12pt;
font-weight : bold;
}
A:hover {
text-decoration : none;
}
H1 {
font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em;
font-weight: bold;
border-bottom : 1px #ccc solid;
padding-bottom : 2px;
}
CODE {
font-family:"Courier New",serif;
font-size:100%;
padding:2px 4px;
color:#111;
}
</style>
</head>
<body>
<h1>Openfire Push Server Plugin</h1>
<h2>Overview</h2>
<p>An <a href="https://xmpp.org/extensions/xep-0357.html"> XEP-0357: Push Notifications</a> app server that relays push messages between the user's server and FCM (Firebase Cloud Messaging) or APNS (Apple Push Notification Service).</p>
<h2>Building</h2>
<p>This project is using the Maven-based Openfire build process, as introduced in Openfire 4.2.0. To build this plugin locally, ensure that the following are available on your local host:</p>
<ul>
<li>A Java Development Kit, version 7 or (preferably) 8</li>
<li>Apache Maven 3</li>
</ul>
<p>To build this project, invoke on a command shell:</p>
<code>$ mvn clean package</code>
<p>Upon completion, the openfire plugin will be available in <code>target/pushserver-openfire-plugin-assembly.jar</code>. This file should be renamed to <code>pushserver.jar</code></p>
<h2>Installation</h2>
<p>
Copy <code>pushserver.jar</code> into the plugins directory of your Openfire server, or use the Openfire Admin Console to upload the plugin. The plugin will then be automatically deployed.
<br>
<br>
To upgrade to a new version, copy the new <code>pushserver.jar</code> file over the existing file.
</p>
<h2>Configuration</h2>
<p>
After installing plugin, you should fill the fields under the page <code>Server -> Server Settings -> Push Server Properties</code>.
<br>
<br>
<b>Note:</b> After filling and saving values, you should restart the plugin.
</p>
<dl>
<dt><b>iOS</b></dt>
<dd>Push Server Plugin uses token-based authentication to communicate with Apple Push Notification service. (For more information, see <a href="https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token-based_connection_to_apns">Establishing a Token-Based Connection to APNs</a>)</dd>
<dd><b>* Bundle Id</b> (<a href="https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids">Bundle IDs</a>)</dd>
<dd><b>* Team Id</b> (<a href="https://help.apple.com/developer-account/#/dev55c3c710c">Locate your Team ID</a>)</dd>
<dd><b>* Key Id</b>
<dd><b>* Encryption Key</b>
<dt><b>Android</b></dt>
<dd>Push Server Plugin uses <i>Firebase Cloud Messaging</i> to send push notifications to Android clients. In order to activate sending push notifications to Android clients, you should create a Firebase project and add Firebase to your Android application. (For more information, see <a href="https://firebase.google.com/docs/android/setup?authuser=0&hl=en">Add Firebase to your Android project</a>)</dd>
<dd><b>* FCM Project Id</b></dd>
<dd><b>* Google Cloud Service Account Key</b> (Service Account Key Json File)</dd>
</dl>
<dl>
<dt>Both of these can be found in your Firebase console, under <i>Project Settings</i>:</dt>
<dd>* The ID is found in the <i>General</i> tab</dd>
<dd>* The Service Account JSON file can be created and downloaded from the <i>Service Account</i> tab. (or <a href="https://cloud.google.com/iam/docs/creating-managing-service-account-keys?hl=en#creating">Create service account key using Google Console</a>)</dd>
</dl>
<h2>Client Configuration</h2>
<h3>Registering Devices</h3>
<p>Clients need to register with push server and get node and secret information</p>
<h4>iOS</h4>
<pre>
<code>
<iq from="[email protected]/mobile" id="x20" to="push.example.com" type="set"
<command xmlns="http://jabber.org/protocol/commands" action="execute" node="register-push-apns">
<x xmlns="jabber:x:data" type="submit">
<field var="token">
<value>243CA5F2A4EE00B66E3208CD05C962A30EFA80B2D9F8DD508CE8182E04EAB695</value>
</field>
<field var="device-id">
<value>0523AD60-ADD0-45A4-8D05-DC1AC59BB1CA</value>
</field>
</x>
</command>
</iq>
<iq from="push.example.com" id="x20" to="[email protected]/mobile" type="result">
<command xmlns="http://jabber.org/protocol/commands" action="complete" node="register-push-apns">
<x xmlns="jabber:x:data" type="form">
<field type="text-single" var="node">
<value>37Ni514izxHG</value>
</field>
<field type="text-single" var="secret">
<value>Zt9z9wOtAUOSYCtYC7a5OORa</value>
</field>
</x>
</command>
</iq>
</code>
</pre>
<h4>Android</h4>
<pre>
<code>
<iq from="[email protected]/mobile" id="x20" to="push.example.com" type="set">
<command xmlns="http://jabber.org/protocol/commands" action="execute" node="register-push-fcm">
<x xmlns="jabber:x:data" type="submit">
<field var="token">
<value>dPrh685pTdGns_MHsu1I-b:APA91bGwfwGthGPxE2aUJ5o-pyn1eMzV0WPqFulpyYo20xOEy7efh8soyJpcCuibleBGjCaRDRgjl6vSYNwDDE7pq0lfKOzubfUvCrvKvLMN4uRLEY373L11sCKqHeOf-_Qn3eooeOge</value>
</field>
<field var="device-id">
<value>0ab43fb78f92ba10</value>
</field>
</x>
</command>
</iq>
<iq from="push.example.com" id="x20" to="[email protected]/mobile" type="result">
<command xmlns="http://jabber.org/protocol/commands" action="complete" node="register-push-fcm">
<x xmlns="jabber:x:data" type="form">
<field type="text-single" var="node">
<value>KmDtdKoUTiGr</value>
</field>
<field type="text-single" var="secret">
<value>FBfIl4qflMTDKn6CYPxXJHyH</value>
</field>
</x>
</command>
</iq>
</code>
</pre>
<h3>Enabling Notifications</h3>
<p>After registering with the push server, Client sends the node ID and the jid of the app server (<i>push.example.com</i>) to the user's server.</p>
<pre>
<code>
<iq type='set' id='x42'>
<enable xmlns='urn:xmpp:push:0' jid='push.example.com' node='KmDtdKoUTiGr'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'><value>http://jabber.org/protocol/pubsub#publish-options</value></field>
<field var='secret'><value>FBfIl4qflMTDKn6CYPxXJHyH</value></field>
</x>
</enable>
</iq>
</code>
</pre>
<p><b>Note:</b> To support sandbox devices in iOS, you should provide the <code><field var="sandbox"><value>true</value></field></code> in publish options.</p>
<h4>Example:</h4>
<pre>
<code>
<iq type='set' id='x42'>
<enable xmlns='urn:xmpp:push:0' jid='push.example.com' node='37Ni514izxHG'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'><value>http://jabber.org/protocol/pubsub#publish-options</value></field>
<field var='secret'><value>Zt9z9wOtAUOSYCtYC7a5OORa</value></field>
<field var="sandbox"><value>true</value></field>
</x>
</enable>
</iq>
</code>
</pre>
<p>More info can be found in <a href="https://xmpp.org/extensions/xep-0357.html#enabling">XEP-0357 Section 5</a></p>
<h3>Disabling Notifications</h3>
<pre>
<code>
<iq type='set' id='x97'>
<disable xmlns='urn:xmpp:push:0' jid='push.example.com' node='37Ni514izxHG' />
</iq>
</code>
</pre>
<p>More info can be found in <a href="https://xmpp.org/extensions/xep-0357.html#disabling">XEP-0357 Section 6</a></p>
<h3>Publishing Notifications</h3>
<p>It can be found in <a href="https://xmpp.org/extensions/xep-0357.html#publishing">XEP-0357 Section 7</a></p>
</body>
</html>