2.1.111 作为跨浏览器使用websocket
Serve(app.js)
const io = require('socket.io')(80)
io.on('connection',(socket)=>{
socket.on('message',()=>{})
socket.on('disconnect',()=>{})
})Client(index.html)
<script>
const socket=io('http://localhost/');
socket.on('connect',()=>{
socket.send('hi')
})
socket.on('message',(msg)=>{})
</script>Last updated
Was this helpful?