Joyit před 2 měsíci
rodič
revize
6452013b67
2 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 7 0
      examples/client-ws2.go
  2. 1 1
      type.go

+ 7 - 0
examples/client-ws2.go

@@ -63,6 +63,13 @@ func main() {
 		log.Fatalln("[client ConnectToServer ERROR]", err)
 	}
 
+	log.Println("start get data")
+	count := hub.Get(remoteFilter, "hello", "hello in get model", func(response *tinymq.ResponseData) (ok bool) {
+		log.Println("get state and data: ", response.State, string(response.Data))
+		return true
+	})
+	log.Println("end get data with count: ", count)
+
 	// 获取信息
 	rsp := hub.GetOne(remoteFilter, "hello", "hello from client,hello from client,hello from client")
 	if rsp.State != config.STATE_OK {

+ 1 - 1
type.go

@@ -148,7 +148,7 @@ func ParseUrl(url string) (hostInfo *HostInfo, err error) {
 		return nil, err
 	}
 	host := mx[3]
-	index := strings.Index(host, "@")
+	index := strings.LastIndex(host, "@")
 	hash := ""
 	if index >= 0 {
 		hash = host[0:index]