频道 / 好友
游客每日最多发送 10 条,公开与私聊频道可用。
好友
公开频道
设置 · 账户 · 部署
身份
游客
今日剩余发送
10
设备识别
-
IP 位置
查询中…
聊天记录
记录保留 2 天,并在刷新后继续读取未过期记录。
后端与 Nginx 配置
server {
listen 80;
server_name chat.kangqiovo.com;
root /www/wwwroot/chat.kangqiovo.com;
add_header Content-Security-Policy "frame-ancestors 'self' https://os.kangqiovo.com" always;
client_max_body_size 20m;
location /socket.io/ {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location /chat-storage/ {
alias /www/wwwroot/chat.kangqiovo.com/chat-storage/;
expires 2d;
}
}
# Node.js Socket.io 后端 (server.js)
const express = require('express');
const http = require('http');
const { Server } = require('socket.io');
const app = express();
const server = http.createServer(app);
const io = new Server(server, { cors: { origin: 'https://chat.kangqiovo.com' } });
io.on('connection', socket => {
socket.on('join', room => socket.join(room));
socket.on('chat message', msg => io.to(msg.channel).emit('chat message', msg));
});
server.listen(3000);