lalala hace 6 años
padre
commit
5561f8e4b2
Se han modificado 1 ficheros con 6 adiciones y 18 borrados
  1. 6 18
      mobile-code/src/utils/chat.js

+ 6 - 18
mobile-code/src/utils/chat.js

@@ -1,5 +1,5 @@
 // import { url } from '@src/utils/axios'
-const DEFAULT_ADDRESS = process.env.NODE_ENV === 'production' ? 'ws://saas.api.beiface.com:1313' : 'http://api.m.huaml.com/chat/begin'
+const DEFAULT_ADDRESS = process.env.NODE_ENV === 'production' ? 'ws://m.huaml.com:8282' : 'ws://m.huaml.com:8282'
 
 const TYPE = {
 	CART: 1
@@ -59,30 +59,18 @@ class Watcher {
 		this.filter = filter
 		this._id = watcherId++
 		this.types = []
-		this._isVaildTypes(types)
 
 		this._register()
 	}
-	_isVaildTypes(types) {
-		if (_.isArray(types)) {
-			types.forEach(type => {
-				this._isVaildTypes(type)
-			})
-		} else {
-			let valid = isValidType(types)
-			if (!valid) throw new Error(`types item is invalid (null  or String), current type is ${type}`)
-		}
-		if (types != null && types != '') this.types.push(types)
-	}
 
 	_register() {
 		Watcher.collection[this._id] = this
 	}
 
-	_destroy() {
-		let collection = Watcher.collection
-		collection[this._id] = null
-	}
+	// _destroy() {
+	// 	let collection = Watcher.collection
+	// 	collection[this._id] = null
+	// }
 	_isNeedReceiveMessage(type, data, source, target) {
 		if (this.types.length == 0) return true
 		let index = this.types.findIndex(_type => {
@@ -121,7 +109,7 @@ const handler = () => {
 			return watcher
 		},
 		destroy() {
-			watcher._destroy()
+			// watcher._destroy()
 			ws.close()
 			watcher = null
 			ws = null