Skip to content
This repository was archived by the owner on Mar 21, 2020. It is now read-only.

Commit f98cdc0

Browse files
committed
use chat.matong.io proxy to chat.socket.io to deploy to wechat
1 parent 300fc07 commit f98cdc0

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

weapp_demo/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const io = require('./wxsocket.io/index.js')
44
App({
55
onLaunch: function() {
66
// create a new socket object
7-
const socket = io("ws://chat.socket.io/")
7+
const socket = io("wss://chat.matong.io/")
88
this.globalData.socket = socket
99
},
1010

weapp_demo/pages/index/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ Page({
2020
app.globalData.nickname = this.data.nickname
2121

2222
app.globalData.socket.emit('add user', this.data.nickname)
23-
24-
wx.navigateTo({
25-
url: '../room/index',
26-
})
2723
},
2824

2925
onLoad: function() {
@@ -38,7 +34,11 @@ Page({
3834
wx.showToast({
3935
title: '登录成功',
4036
icon: 'success',
41-
duration: 3000
37+
duration: 1000
38+
})
39+
40+
wx.navigateTo({
41+
url: '../room/index',
4242
})
4343
})
4444
}

weapp_demo/pages/index/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
}
1414

1515
.nickname {
16+
width: 300px;
1617
color: #aaa;
1718
border-bottom: 1rpx solid #3e3e3e;
1819
text-align: center;

weapp_demo/pages/room/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ Page({
5151
wx.showToast({
5252
title: msg.username + ' 加入了房间',
5353
icon: 'success',
54-
duration: 2000
54+
duration: 1000
5555
})
5656
})
5757

5858
socket.on('user left', function(msg) {
5959
wx.showToast({
6060
title: msg.username + ' 离开了房间',
6161
icon: 'loading',
62-
duration: 2000
62+
duration: 1000
6363
})
6464
})
6565
}

0 commit comments

Comments
 (0)