Jumi Yang

Finish chat

......@@ -18,7 +18,7 @@ io.on('connection', (socket) => {
io.emit("chatting", {
name,
msg,
time: moment.format("h:ss A")
time: moment(new Date()).format("h:ss A")
})
})
});
......
......@@ -239,7 +239,8 @@
},
"node_modules/express": {
"version": "4.18.1",
"license": "MIT",
"resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz",
"integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
......@@ -425,7 +426,8 @@
},
"node_modules/moment": {
"version": "2.29.3",
"license": "MIT",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
"integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==",
"engines": {
"node": "*"
}
......@@ -599,7 +601,8 @@
},
"node_modules/socket.io": {
"version": "4.5.1",
"license": "MIT",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.1.tgz",
"integrity": "sha512-0y9pnIso5a9i+lJmsCdtmTTgJFFSvNQKDnPQRz28mGNnxbmqYg2QPtJTLFxhymFZhAIn50eHAKzJeiNaKr+yUQ==",
"dependencies": {
"accepts": "~1.3.4",
"base64id": "~2.0.0",
......@@ -873,6 +876,8 @@
},
"express": {
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz",
"integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==",
"requires": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
......@@ -989,7 +994,9 @@
}
},
"moment": {
"version": "2.29.3"
"version": "2.29.3",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
"integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw=="
},
"ms": {
"version": "2.0.0"
......@@ -1091,6 +1098,8 @@
},
"socket.io": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.1.tgz",
"integrity": "sha512-0y9pnIso5a9i+lJmsCdtmTTgJFFSvNQKDnPQRz28mGNnxbmqYg2QPtJTLFxhymFZhAIn50eHAKzJeiNaKr+yUQ==",
"requires": {
"accepts": "~1.3.4",
"base64id": "~2.0.0",
......
"use strict"
const socket = io.connect("http://localhost:3000/", {transports:['websocket']});
//const socket = io.connect("http://localhost:3000/", {transports:['websocket']});
const socket = io();
const nickname = document.querySelector("#nickname")
const chatlist = document.querySelector(".chatting-list")
......