This commit is contained in:
SelfRidicule 2024-08-22 18:59:58 +08:00
parent 6bc275e815
commit 47d93bb036
2 changed files with 18 additions and 2 deletions

View File

@ -38,7 +38,7 @@ Page({
getAllRoomInfoRq().then(res => {
console.log('getAllRoomInfoRq', res);
_this.setData({
roomList : res.rows
roomList : res.data
})
})
},

View File

@ -295,6 +295,20 @@ Page({
})
},
// 初始化socket
initSocket() {
const ws = new WebSocket("ws:///222.184.49.22:8081/websocket-server");
ws.onopen = function () {
console.log('链接建立成功')
};
ws.onmessage = function (evt) {
console.log(evt.data)
};
ws.onclose = function () {
console.log('链接已经关闭')
};
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -306,7 +320,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
let _this = this
// 初始化socket
_this.initSocket()
},
/**