-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcloudNotifications.html
More file actions
146 lines (116 loc) · 5.49 KB
/
cloudNotifications.html
File metadata and controls
146 lines (116 loc) · 5.49 KB
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
<!-- CloudNotifications -->
<div class="method">
<a id='CloudNotifcations' name="CloudNotifcations" class="section-anchor"> </a>
<div class="method-section">
<div class="method-description">
<h1>CloudNotifcations</h1>
<p>
In Cloudboost, you can create realtime notification channels, publish messages to those channels and have other clients listen to those messages which are being published in real time.
</p>
</div>
</div>
<a id='CloudNotification-on' name="CloudNotification-on" class="section-anchor"> </a>
<div class="method-section">
<div class="method-description">
<h3>CloudNotification.on( <code>channelName, functionToFire</code> )</h3>
<p>
Listens to notification channels.
</p>
<h3>Package</h3>
<p>
<code>import com.cloudboost.CloudNotification;</code>
</p>
<div class="method-list">
<h6>Arguments</h6>
<dl class="argument-list">
<dt>channelName</dt>
<dd class="">String<span>channel to listen to.</span></dd>
<div class="clearfix"></div>
<dt>functionToFire</dt>
<dd class="">function <span> function to fire when data on this channel is published.</span></dd>
<div class="clearfix"></div>
</dl>
<h6>Returns</h6>
<p>void</p>
<h6>Error Handling</h6>
<p>It throws <code>CloudBoostException</code></p>
</div>
</div>
<div class="method-example" id="api-summary-example">
<code class="method-request"><span class="prompt"></span><span class="lang lang-node"><span class="highlight_js javascript">
//intializing CloudNotificationMethod, and overriding methods
CloudNotificationCallback cloudNotificationMethodObject = new CloudNotificationCallback(){
@Override
public void done(Object data,CloudException e) {
// override this function as per your requirnment.
System.out.println("message : " + data);
}
};
CloudNotification.on("sample", cloudNotificationMethodObj);
</span></span></code>
</div><!-- method-example -->
</div> <!-- method-section -->
<a id='CloudNotification-publish' name="CloudNotification-publish" class="section-anchor"> </a>
<div class="method-section">
<div class="method-description">
<h3>CloudNotification.publish( <code>channelName, data</code> )</h3>
<p>
Publishes data to notification channels.
</p>
<div class="method-list">
<h6>Arguments</h6>
<dl class="argument-list">
<dt>channelName</dt>
<dd class="">String<span>channel to publish to.</span></dd>
<div class="clearfix"></div>
<dt>data</dt>
<dd class="">Anything <span> data you want to publish to this channel</span></dd>
<div class="clearfix"></div>
</dl>
<h6>Returns</h6>
<p>void</p>
<h6>Error Handling</h6>
<p>It throws <code>CloudBoostException</code></p>
</div>
</div>
<div class="method-example" id="api-summary-example">
<code class="method-request"><span class="prompt"></span><span class="lang lang-node"><span class="highlight_js javascript">
CloudNotification.publish("sample","data");
</span></span></code>
</div><!-- method-example -->
</div> <!-- method-section -->
<a id='CloudNotification-off' name="CloudNotification-off" class="section-anchor"> </a>
<div class="method-section">
<div class="method-description">
<h3>CloudNotification.off( <code>channelName, functionToFire</code> )</h3>
<p>
Stops listening to notification channels.
</p>
<div class="method-list">
<h6>Arguments</h6>
<dl class="argument-list">
<dt>channelName</dt>
<dd class="">String<span>channel to stop listening to.</span></dd>
<div class="clearfix"></div>
</dl>
<h6>Returns</h6>
<p>void</p>
<h6>Error Handling</h6>
<p>It throws <code>CloudBoostException</code></p>
</div>
</div>
<div class="method-example" id="api-summary-example">
<code class="method-request"><span class="prompt"></span><span class="lang lang-node"><span class="highlight_js javascript">
//intializing CloudNotificationMethod, and overriding methods
CloudNotificationCallback cloudNotificationMethodObject = new CloudNotificationCallback(){
@Override
public void done(Object data,CloudException e) {
// override this function as per your requirnment.
System.out.println("Unsubscribed");
}
};
CloudNotification.off("sample", cloudNotificationMethodObj);
</span></span></code>
</div><!-- method-example -->
</div> <!-- method-section -->
</div>