當前位置: 首頁>>代碼示例>>Golang>>正文


Golang messaging.GetNonSubscribeTimeout函數代碼示例

本文整理匯總了Golang中github.com/pubnub/go/messaging.GetNonSubscribeTimeout函數的典型用法代碼示例。如果您正苦於以下問題:Golang GetNonSubscribeTimeout函數的具體用法?Golang GetNonSubscribeTimeout怎麽用?Golang GetNonSubscribeTimeout使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetNonSubscribeTimeout函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SetUpChannelGroup

func SetUpChannelGroup() {
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)
	done := make(chan bool)

	pubnub := messaging.NewPubnub(config.Keys.Pub, config.Keys.Sub, "", "",
		false, "")

	pubnub.SetAuthenticationKey(bootstrapAuth)

	// Remove Group
	go pubnub.ChannelGroupRemoveGroup(config.StocksChannelGroup,
		successChannel, errorChannel)
	go handleResponse(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), done)

	<-done

	// Create it from the scratch
	go pubnub.ChannelGroupAddChannel(config.StocksChannelGroup, stockNames,
		successChannel, errorChannel)
	go handleResponse(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), done)

	<-done
}
開發者ID:anovikov1984,項目名稱:real-time-stocks-go,代碼行數:26,代碼來源:stocks.go

示例2: GrantPermissions

func GrantPermissions() {
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)

	done := make(chan bool)

	pubnub := messaging.NewPubnub(config.Keys.Pub, config.Keys.Sub,
		config.Keys.Secret, "", false, "")

	pubnub.SetAuthenticationKey(bootstrapAuth)

	// Allow current Pubnub instance to managet the channel group
	go pubnub.GrantChannelGroup(config.StocksChannelGroup,
		false, true, config.GrantTTL,
		bootstrapAuth, successChannel, errorChannel)
	go handleResponse(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), done)

	<-done

	// Allow unauthorized users to subscribe to stockblast channel group
	go pubnub.GrantChannelGroup(config.StocksChannelGroup,
		true, false, config.GrantTTL,
		"", successChannel, errorChannel)
	go handleResponse(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), done)

	<-done

	// Unauthorized users can both read and write on chat channel
	go pubnub.GrantSubscribe(config.ChatChannel, true, true, config.GrantTTL, "",
		successChannel, errorChannel)
	go handleResponse(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), done)

	<-done

	// Unauthorized users can only read history
	go pubnub.GrantSubscribe(config.HistoryChannel,
		true, false, config.GrantTTL, "", successChannel, errorChannel)
	go handleResponse(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), done)

	<-done

	// Allow stock tickers authorized by auths.Auth key to publish to stock
	// channels
	go pubnub.GrantSubscribe(stockNames, false, true, config.GrantTTL,
		config.Keys.Auth, successChannel, errorChannel)
	go handleResponse(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), done)

	<-done
}
開發者ID:anovikov1984,項目名稱:real-time-stocks-go,代碼行數:54,代碼來源:stocks.go

示例3: publishRoutine

// publishRoutine asks the user the message to send to the pubnub channel(s) and
// calls the Publish routine of the messaging package as a parallel
// process. If we have multiple pubnub channels then this method will spilt the
// channel by comma and send the message on all the pubnub channels.
func publishRoutine(channels string, message string) {
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)
	fmt.Println("Publishing message: ", message)
	go pub.Publish(channels, message, successChannel, errorChannel)
	go handleResult(successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Publish")
}
開發者ID:GleasonK,項目名稱:go,代碼行數:11,代碼來源:page-through-history.go

示例4: unsubscribePresenceRoutine

// UnsubscribePresenceRoutine calls the PresenceUnsubscribe routine of the messaging package as a parallel
// process. All the channels in the _connectChannels string will be unsubscribed.
func unsubscribePresenceRoutine(channels string) {
	var errorChannel = make(chan []byte)
	channel := make(chan []byte)
	channelArray := strings.Split(channels, ",")
	go pub.PresenceUnsubscribe(channels, channel, errorChannel)
	go handleUnsubscribeResult(channel, errorChannel, messaging.GetNonSubscribeTimeout(), "UnsubscribePresence", len(channelArray)*2)
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:9,代碼來源:pubnubExample.go

示例5: grantSubscribe

func grantSubscribe(w http.ResponseWriter, r *http.Request) {
	q := r.URL.Query()
	ch := q.Get("ch")
	read := q.Get("r")
	write := q.Get("w")
	ttl := q.Get("ttl")
	bRead := false
	if read == "1" {
		bRead = true
	}
	bWrite := false
	if write == "1" {
		bWrite = true
	}
	iTTL := 1440
	if ival, err := strconv.Atoi(ttl); err == nil {
		iTTL = ival
	}

	uuid := q.Get("uuid")
	pubInstance := messaging.NewPubnub(publishKey, subscribeKey, secretKey, "", true, uuid)
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)
	go pubInstance.GrantSubscribe(ch, bRead, bWrite, iTTL, "", successChannel, errorChannel)
	handleResult(w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Revoke Subscribe")
}
開發者ID:pubnub,項目名稱:go,代碼行數:26,代碼來源:main.go

示例6: whereNowRoutine

// WhereNowRoutine
func whereNowRoutine(uuid string) {
	fmt.Println("WhereNow ", uuid)
	var errorChannel = make(chan []byte)
	successChannel := make(chan []byte)
	go pub.WhereNow(uuid, successChannel, errorChannel)
	go handleResult(successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "WhereNow")
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:8,代碼來源:pubnubExample.go

示例7: globalHereNowRoutine

func globalHereNowRoutine(showUuid bool, includeUserState bool) {
	fmt.Println("Global here now ", uuid)
	var errorChannel = make(chan []byte)
	successChannel := make(chan []byte)
	go pub.GlobalHereNow(showUuid, includeUserState, successChannel, errorChannel)
	go handleResult(successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Global Here Now")
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:7,代碼來源:pubnubExample.go

示例8: detailedHistoryRoutine

// detailedHistoryRoutine calls the History routine of the messaging package as a parallel
// process. If we have multiple pubnub channels then this method will spilt the _connectChannels
// by comma and send the message on all the pubnub channels.
func detailedHistoryRoutine(channels string, startTime int64) {
	errorChannel := make(chan []byte)
	channel := make(chan []byte)
	fmt.Println(fmt.Sprintf("Page Size :%d", pageSize))
	go pub.History(channels, pageSize, startTime, 0, false, channel, errorChannel)
	go handleDetailedHistoryResult(channel, errorChannel, messaging.GetNonSubscribeTimeout(), "Detailed History")
}
開發者ID:GleasonK,項目名稱:go,代碼行數:10,代碼來源:page-through-history.go

示例9: addChannelToChannelGroupRoutine

func addChannelToChannelGroupRoutine(group, channels string) {
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)

	go pub.ChannelGroupAddChannel(group, channels, successChannel, errorChannel)
	go handleResult(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), "Channel Group Add Channel")
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:8,代碼來源:pubnubExample.go

示例10: removeChannelGroupRoutine

func removeChannelGroupRoutine(group string) {
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)

	go pub.ChannelGroupRemoveGroup(group, successChannel, errorChannel)
	go handleResult(successChannel, errorChannel,
		messaging.GetNonSubscribeTimeout(), "Channel Group Remove")
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:8,代碼來源:pubnubExample.go

示例11: pamAuditChannelGroupRoutine

func pamAuditChannelGroupRoutine(groups, auth string) {
	var errorChannel = make(chan []byte)
	var pamChannel = make(chan []byte)

	go pub.AuditChannelGroup(groups, auth, pamChannel, errorChannel)
	go handleResult(pamChannel, errorChannel, messaging.GetNonSubscribeTimeout(),
		"Channel Group Audit")
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:8,代碼來源:pubnubExample.go

示例12: pamGrantChannelGroupRoutine

func pamGrantChannelGroupRoutine(groups, auth string,
	read, manage bool, ttl int) {
	var errorChannel = make(chan []byte)
	var pamChannel = make(chan []byte)

	go pub.GrantChannelGroup(groups, read, manage, ttl, auth,
		pamChannel, errorChannel)
	go handleResult(pamChannel, errorChannel, messaging.GetNonSubscribeTimeout(),
		"Channel Group Grant")
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:10,代碼來源:pubnubExample.go

示例13: pamAuditRoutine

// pamAuditRoutine calls the AuditPresence or AuditSubscribe routine of the messaging package
// as a parallel process.
func pamAuditRoutine(channels string, isPresence bool) {
	var errorChannel = make(chan []byte)
	var pamChannel = make(chan []byte)
	if isPresence {
		go pub.AuditPresence(channels, "", pamChannel, errorChannel)
	} else {
		go pub.AuditSubscribe(channels, "", pamChannel, errorChannel)
	}
	go handleResult(pamChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Audit")
}
開發者ID:anovikov1984,項目名稱:go,代碼行數:12,代碼來源:pubnubExample.go

示例14: revokeSubscribe

func revokeSubscribe(w http.ResponseWriter, r *http.Request) {
	q := r.URL.Query()
	ch := q.Get("ch")
	uuid := q.Get("uuid")
	pubInstance := messaging.NewPubnub(publishKey, subscribeKey, secretKey, "", true, uuid)
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)
	go pubInstance.GrantSubscribe(ch, false, false, 0, "", successChannel, errorChannel)
	handleResult(w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Revoke Subscribe")
}
開發者ID:pubnub,項目名稱:go,代碼行數:10,代碼來源:main.go

示例15: getTime

func getTime(w http.ResponseWriter, r *http.Request) {
	q := r.URL.Query()
	uuid := q.Get("uuid")

	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)

	pubInstance := messaging.NewPubnub(publishKey, subscribeKey, secretKey, "", true, uuid)
	go pubInstance.GetTime(successChannel, errorChannel)
	handleResult(w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Time")
}
開發者ID:pubnub,項目名稱:go,代碼行數:11,代碼來源:main.go


注:本文中的github.com/pubnub/go/messaging.GetNonSubscribeTimeout函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。