first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import io from '@hyoga/uni-socket.io';
class socket {
constructor() {
this.socket = null;
this.init();
}
init () {
this.socket = io('http://192.168.31.101:3000', {
query: {},
transports: [ 'websocket', 'polling' ],
timeout: 5000,
});
this.onEvent();
}
onEvent() {
this.socket.on("connect", () => {
console.log("链接建立成功...")
uni.showToast({
icon: "none",
title: "debug 成功链接服务器...",
duration: 1000,
});
});
this.socket.on("error", (msg) => {
console.log('链接错误:', msg);
})
}
}
export default new socket();