-
Notifications
You must be signed in to change notification settings - Fork 0
/
omg.php
41 lines (34 loc) · 936 Bytes
/
omg.php
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
<!DOCTYPE html>
<html lang="fr">
<head>
<script src="lib/jQuery/jquery-2.2.1.min.js"></script>
</head>
<body role="document">
<input type="text"/>
</body>
<?php
echo '<script type="text/javascript">
$(document).ready(function () {
console.log("connecting to the sockets");
connectToSocketsServer();
});
function connectToSocketsServer() {
var host = "ws://10.10.10.220:8686/websockets"; // SET THIS TO YOUR SERVER
try {
socket = new WebSocket(host);
// quand on recoit une notif du serveur
socket.onmessage = function (msg) {
console.log("Socket - message received: " + msg.data);
switch (msg.data) {
case "identificate" :
console.log("receved message");
break;
}
}
} catch (ex) {
console.log(ex);
}
}
</script>';
?>
</html>