• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang messaging.GetNonSubscribeTimeout函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/pubnub/go/messaging.GetNonSubscribeTimeout函数的典型用法代码示例。如果您正苦于以下问题:Golang GetNonSubscribeTimeout函数的具体用法?Golang GetNonSubscribeTimeout怎么用?Golang GetNonSubscribeTimeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetNonSubscribeTimeout函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: 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) {
	var errorChannel = make(chan []byte)
	channelArray := strings.Split(channels, ",")

	for i := 0; i < len(channelArray); i++ {
		ch := strings.TrimSpace(channelArray[i])
		fmt.Println("Publish to channel: ", ch)
		channel := make(chan []byte)
		go pub.Publish(ch, message, channel, errorChannel)
		go handleResult(channel, errorChannel, messaging.GetNonSubscribeTimeout(), "Publish")
	}
}
开发者ID:anovikov1984,项目名称:go,代码行数:16,代码来源:pubnubExample.go


示例17: hereNowRoutine

// HereNowRoutine calls the HereNow 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 hereNowRoutine(channels string, showUuid bool, includeUserState bool) {
	var errorChannel = make(chan []byte)
	channelArray := strings.Split(channels, ",")
	for i := 0; i < len(channelArray); i++ {
		channel := make(chan []byte)
		ch := strings.TrimSpace(channelArray[i])
		fmt.Println("HereNow for channel: ", ch)

		go pub.HereNow(ch, showUuid, includeUserState, channel, errorChannel)
		go handleResult(channel, errorChannel, messaging.GetNonSubscribeTimeout(), "HereNow")
	}
}
开发者ID:anovikov1984,项目名称:go,代码行数:15,代码来源:pubnubExample.go


示例18: setUserStateJSON

func setUserStateJSON(w http.ResponseWriter, r *http.Request) {
	q := r.URL.Query()
	ch := q.Get("ch")
	j := q.Get("j")
	uuid := q.Get("uuid")
	pubInstance := messaging.NewPubnub(publishKey, subscribeKey, secretKey, "", true, uuid)
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)

	go pubInstance.SetUserStateJSON(ch, j, successChannel, errorChannel)
	handleResult(w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Set User State JSON")
}
开发者ID:pubnub,项目名称:go,代码行数:12,代码来源:main.go


示例19: 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) {
	var errorChannel = make(chan []byte)
	channelArray := strings.Split(channels, ",")
	for i := 0; i < len(channelArray); i++ {
		ch := strings.TrimSpace(channelArray[i])
		fmt.Println("DetailedHistory for channel: ", ch)

		channel := make(chan []byte)

		//go _pub.History(ch, 100, 13662867154115803, 13662867243518473, false, channel)
		go pub.History(ch, 100, 0, 0, false, channel, errorChannel)
		go handleResult(channel, errorChannel, messaging.GetNonSubscribeTimeout(), "Detailed History")
	}
}
开发者ID:anovikov1984,项目名称:go,代码行数:17,代码来源:pubnubExample.go


示例20: detailedHistory

func detailedHistory(w http.ResponseWriter, r *http.Request) {
	q := r.URL.Query()
	ch := q.Get("ch")
	uuid := q.Get("uuid")
	start := q.Get("start")
	var iStart int64
	if strings.TrimSpace(start) != "" {
		bi := big.NewInt(0)
		if _, ok := bi.SetString(start, 10); !ok {
			iStart = 0
		} else {
			iStart = bi.Int64()
		}
	}

	end := q.Get("end")
	var iEnd int64
	if strings.TrimSpace(end) != "" {
		bi := big.NewInt(0)
		if _, ok := bi.SetString(end, 10); !ok {
			iEnd = 0
		} else {
			iEnd = bi.Int64()
		}
	}

	limit := q.Get("limit")
	reverse := q.Get("reverse")

	iLimit := 100
	if ival, err := strconv.Atoi(limit); err == nil {
		iLimit = ival
	}

	bReverse := false
	if reverse == "1" {
		bReverse = true
	}

	pubInstance := messaging.NewPubnub(publishKey, subscribeKey, secretKey, "", true, uuid)
	errorChannel := make(chan []byte)
	successChannel := make(chan []byte)

	go pubInstance.History(ch, iLimit, iStart, iEnd, bReverse, false, successChannel, errorChannel)
	handleResult(w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Detailed History")
}
开发者ID:pubnub,项目名称:go,代码行数:46,代码来源:main.go



注:本文中的github.com/pubnub/go/messaging.GetNonSubscribeTimeout函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang messaging.NewPubnub函数代码示例发布时间:2022-05-28
下一篇:
Golang messaging.New函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap