基于socket的聊天室
参考
1.b站就是b站,啥都有
2.github官方文档
1.视频很详细,所以它很长,不太好跳过,容易错过重点
2.最基础的socket方法emit/on
socket.emit(事件名,data);
socket.on(和emit的事件名一直,data=>{函数体});
3.不用考虑跨域,美滋滋
1.放一下自己的代码
//client.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.container{
border: 1px solid green;
background: greenyellow;
}
.message{
color: pink;
}
.people{
color: red;
}
</style>
</head>
<body>
<div id="content" class=