-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.html
44 lines (32 loc) · 1.17 KB
/
main.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Socket.io</title>
</head>
<body>
<h1>Communication avec socket.io !</h1>
<p>
<input type="button" value="Embêter le serveur" id="poke" onclick="callServer()" />
</p>
<p>
<input type="button" value="Embêter le serveur" id="poke" onclick="testConnect()" />
</p>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8080');
socket.on('message', function(message) {
alert('Le serveur a un message pour vous : '+message);
});
function callServer() {
socket.emit('executeHelloC', "hello there");//execute: le code que l'on veut executer, ensuite, c'est le message qu'on envoie au serveur
}
function testConnect() {
var login = "Camille";
var pwd = "abcdef";
socket.emit('executeconnect',login+";"+pwd);
}
</script>
</body>
</html>