让unisocket通用化;把showToast(...)集成在 cToast库里
This commit is contained in:
@@ -5,11 +5,11 @@ const my = {
|
||||
}
|
||||
|
||||
module.exports={
|
||||
initSocket(){
|
||||
if (!my.socket || my.socket.readyState!==my.socket.OPEN && getApp()._SS.nodeHost) {
|
||||
initSocket(url){
|
||||
if (!my.socket || my.socket.readyState!==my.socket.OPEN && typeof(url)==='string') {
|
||||
console.log('WebSocket connecting...')
|
||||
my.socket = uni.connectSocket({
|
||||
url: getApp()._SS.nodeHost.replace(/^http/, 'ws'),
|
||||
url: url.replace(/^http/, 'ws'),
|
||||
complete: ()=>{}
|
||||
})
|
||||
my.socket.onOpen((res)=>{
|
||||
|
||||
Reference in New Issue
Block a user