-
Notifications
You must be signed in to change notification settings - Fork 0
/
client-ims.html
54 lines (48 loc) · 1.71 KB
/
client-ims.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
<!DOCTYPE html>
<head>
<title>Pusher Notification IMS</title>
<link rel="stylesheet" type="text/css" href="node_modules/noty/lib/noty.css">
<link rel="stylesheet" type="text/css" href="node_modules/noty/src/themes/bootstrap-v4.css">
<link rel="stylesheet" type="text/css" href="node_modules/noty/src/themes/mint.css">
<link rel="stylesheet" type="text/css" href="node_modules/noty/src/themes/nest.css">
<script type="text/javascript" src="node_modules/noty/lib/noty.min.js"></script>
<script src="pusher.min.js"></script>
<!-- <script src="https://js.pusher.com/4.1/pusher.min.js"></script> -->
<script>
// Enable pusher logging - don't include this in production
// Pusher.logToConsole = true;
/*Pusher.log = function(msg) {
console.log(msg);
};*/
var pusher = new Pusher('b7f6904b034d9b3bf50b', {
cluster: 'ap1',
encrypted: true
});
var channel = pusher.subscribe('iodev_channel');
channel.bind('iodev_event', function(data) {
var datas = JSON.stringify(data);
var pesan = ' From: <b>'+data.data.name+'</b>,<br> Message: <b>'+data.data.message+'</b>'
new Noty({
sounds : {
sources: 'notification_sound.mp3',
volume: 4
},
type : 'info',
layout : 'topRight',
theme : 'nest',
text: pesan
}).show();
var audio = new Audio('notification_sound.mp3');
audio.play();
// alert(JSON.stringify(data));
console.log(data);
});
</script>
</head>
<body>
<h1>Pusher Pusher Notification IMS</h1>
<p>
Try publishing an event to channel <code>my-channel</code>
with event name <code>my-event</code>.
</p>
</body>