作者:奋斗放个,来自原文地址
//utils文件夹下websoctet.js文件
var url = 'ws://地址端口';
function connect(user, func) {
wx.connectSocket({
url: url,
header: {"content-type":'application/x-www-form-urlencoded'}
});
wx.onSocketOpen(function (res) {
send('{"type":"login","client_name":"'+user.nickName+'","room_id":"1"}'
1