-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndex.html
75 lines (54 loc) · 1.86 KB
/
Index.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.js"></script>
</head>
<body>
<p> Hello world </p>
<script >
// first step
// const socket = io(); // Connect to the Socket.io server
// socket.on('message',function(data){ //socket inbuild function for send message
// alert(data)
// })
//second step
// const socket = io(); // Connect to the Socket.io server
// socket.on('mycustomCode',function(data){ // get message from server side with self made
// alert(data.info)
// })
//third step
// const socket = io(); // Connect to the Socket.io server
// // socket.emit('mycustom_message_from_client_side','Hi Iam ROHIT THAKUR form client side'); // send messgae fron client side to server side
// forth step
// const socket = io(); // Connect to the Socket.io server
// // socket.on('broadcast',function(data){ //use to show user connected to all users
// // document.body.innerHTML=''
// // document.write(data.message);
// // })
// fifth step
// const socket = io(); // Connect to the Socket.io server
// socket.on('newuserconnected',function(data){ //use to show user connected to all users
// document.body.innerHTML=''
// document.write(data.message);
// })
//sixth step //test event calls
// const socket = io('/custom-namespace'); // Connect to the Socket.io server
// socket.on('testevent_with_namespace',function(data){
// document.body.innerHTML=''
// document.write(data);
// })
//Seventh step
// const socket = io();
// socket.on('connectedRoom',function(data){
// document.body.innerHTML=''
// document.write(data)
// })
//eight step error handling
// const socket = io()
// socket.on('connection-failed',function(){
// alter('sorry connection failed')
// })
</script>
</body>
</html>