Exemplo n.º 1
0
func CommonUserState(pubnubInstance *messaging.Pubnub, t *testing.T, channel string, key string, val string, testName string) {
	returnSubscribeChannel := make(chan []byte)
	errorChannel := make(chan []byte)
	waitChannel := make(chan string)
	//returnChannel := make(chan []byte)
	responseChannel := make(chan string)

	go pubnubInstance.Subscribe(channel, "", returnSubscribeChannel, false, errorChannel)
	go ParseSubcribeResponseForUserState(pubnubInstance, t, returnSubscribeChannel, channel, key, val, testName, responseChannel)
	go ParseResponseDummy(errorChannel)
	//go ParseErrorResponse(errorChannel, responseChannel)
	go WaitForCompletion(responseChannel, waitChannel)
	ParseWaitResponse(waitChannel, t, testName)
	go pubnubInstance.Unsubscribe(channel, returnSubscribeChannel, errorChannel)
	pubnubInstance.CloseExistingConnection()
	time.Sleep(2 * time.Second)
}