扫一扫分享
weapp.socket.io安装
npm i weapp.socket.io
或者
git clone https://github.com/wxsocketio/weapp.socket.io.git
weapp.socket.io示例
const io = require('./yout_path/weapp.socket.io.js')
const socket = io('http://localhost:8000')
socket.on('news', d => {
console.log('received news: ', d)
})
socket.emit('news', {
title: 'this is a news'
})
手机预览