mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 03:13:15 +08:00 
			
		
		
		
	test
This commit is contained in:
		
							parent
							
								
									a9ab9baa23
								
							
						
					
					
						commit
						97636c4c7a
					
				@ -66,16 +66,13 @@ func TestRecvOnline(t *testing.T) {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
	pubsub := ts.rdb.Subscribe(ctx, cachekey.OnlineChannel)
 | 
			
		||||
 | 
			
		||||
	// 等待订阅确认
 | 
			
		||||
	_, err := pubsub.Receive(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatalf("Could not subscribe: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 创建一个通道来接收消息
 | 
			
		||||
	ch := pubsub.Channel()
 | 
			
		||||
 | 
			
		||||
	// 处理接收到的消息
 | 
			
		||||
	for msg := range ch {
 | 
			
		||||
		fmt.Printf("Received message from channel %s: %s\n", msg.Channel, msg.Payload)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user