-
Notifications
You must be signed in to change notification settings - Fork 0
/
client2.html
54 lines (48 loc) · 1.2 KB
/
client2.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>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="http://localhost/socket.io/socket.io.js"></script>
<script>
/*var data = {
t: 13313113, //tiempo en el que se envia el msg
oid: "[email protected]", //id del cliente origen
oname: "chef1", //nombre del cliente origen
did: "[email protected]", //id del destinatario del msg
msg: "olakase", //msg
plate: "aros", //nombre del plato
plateid: 3231 //id del plato
}*/
var socket = io.connect('http://localhost:80', { 'forceNew': true, query:'loggeduser=b'});
var data = {
t: 13313113,
oid: "b",
oname: "chef1",
did: "a",
msg: "olakase A",
plate: "aros",
plateid: 3231
}
socket.on('connect', function() {
console.log("Connected!");
});
socket.on('incomingMsg', function(dataReceived, callback) {
console.log(dataReceived);
if (callback!=undefined) {
callback(true)
}
});
function sendMSG(m) {
data.msg = m
socket.emit('sendThat',data, function(success) {
if (success) {
console.log("enviado correctamente");
}
});
}
</script>
</head>
<body>
<h1>A</h1>
</body>
</html>