update
This commit is contained in:
parent
405a631293
commit
1d8239181e
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
本项目基于聊天室的案例演示了 [weapp.socket.io](https://github.com/wxsocketio/weapp.socket.io) 的基本用法.
|
本项目基于聊天室的案例演示了 [weapp.socket.io](https://github.com/wxsocketio/weapp.socket.io) 的基本用法.
|
||||||
|
|
||||||
Server 端使用的是 [socket.io](https://socket.io) 官方的 [chat demo](https://github.com/socketio/socket.io/tree/master/examples/chat) 源码, 部署在了 [heroku](https://vast-plateau-30681.herokuapp.com/) 上.
|
Server 端使用的是 [socket.io](https://socket.io) 官方的 [chat demo](https://socket.io/demos/chat/), 你可以同时使用两者进行聊天测试。
|
||||||
|
|
||||||
> 默认使用了 Socket.io 官网版本
|
> 默认使用了 Socket.io 官网版本
|
||||||
|
|
||||||
> 注意: 因为 Server 的地址是 `HTTPS`的, 由于小程序开发版本对域名的限制, 请在`微信开发者工具` -> `详情` 菜单中勾选 `不校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书`
|
> 注意:
|
||||||
|
> 因为 Server 的地址是 `HTTPS` 的, 由于小程序开发版本对域名的限制,
|
||||||
|
> 请在 `微信开发者工具` -> `详情` 菜单中勾选 `不校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书`
|
||||||
|
|
||||||
|
|
||||||
<img src="./screenshots_1.png" width="50%">
|
<img src="./screenshots_1.png" width="50%">
|
||||||
|
|
|
||||||
8
app.json
8
app.json
|
|
@ -1,9 +1,5 @@
|
||||||
{
|
{
|
||||||
"pages": [
|
"pages": ["pages/index/index", "pages/chat/index"],
|
||||||
"pages/index/index",
|
|
||||||
"pages/chat/index",
|
|
||||||
"pages/file/index"
|
|
||||||
],
|
|
||||||
"window": {
|
"window": {
|
||||||
"backgroundTextStyle": "light",
|
"backgroundTextStyle": "light",
|
||||||
"navigationBarBackgroundColor": "#fff",
|
"navigationBarBackgroundColor": "#fff",
|
||||||
|
|
@ -11,4 +7,4 @@
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
},
|
},
|
||||||
"sitemapLocation": "sitemap.json"
|
"sitemapLocation": "sitemap.json"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,30 +0,0 @@
|
||||||
const io = require('../../utils/weapp.socket.io.dev.js');
|
|
||||||
const base64 = require('./base64');
|
|
||||||
|
|
||||||
Page({
|
|
||||||
/**
|
|
||||||
* 页面的初始数据
|
|
||||||
*/
|
|
||||||
data: {},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面加载
|
|
||||||
*/
|
|
||||||
onLoad: function(options) {
|
|
||||||
const buf = io('http://localhost:3000/buf', {
|
|
||||||
path: '/test',
|
|
||||||
});
|
|
||||||
|
|
||||||
// const base64 = 'CxYh';
|
|
||||||
const bbb = wx.base64ToArrayBuffer(base64);
|
|
||||||
console.log('bbb: ', bbb);
|
|
||||||
|
|
||||||
// socket.on('connection', () => {});
|
|
||||||
// const arrayBuffer = wx.base64ToArrayBuffer('CxYh');
|
|
||||||
// console.log('buffer: ', arrayBuffer.length);
|
|
||||||
|
|
||||||
buf.emit('upload', new Uint8Array(bbb));
|
|
||||||
},
|
|
||||||
|
|
||||||
open: function(e) {},
|
|
||||||
});
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<view>
|
|
||||||
<button bindtap="open">Open file</button>
|
|
||||||
</view>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
/* pages/file/index.wxss */
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue