本文整理汇总了Golang中github.com/pubnub/go/gae/messaging.GetNonSubscribeTimeout函数的典型用法代码示例。如果您正苦于以下问题:Golang GetNonSubscribeTimeout函数的具体用法?Golang GetNonSubscribeTimeout怎么用?Golang GetNonSubscribeTimeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNonSubscribeTimeout函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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")
c := appengine.NewContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
go pubInstance.GrantSubscribe(c, w, r, ch, bRead, bWrite, iTTL, successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Revoke Subscribe")
}
开发者ID:kiran-mk,项目名称:go,代码行数:27,代码来源:main.go
示例2: hereNow
func hereNow(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
channel := q.Get("ch")
uuid := q.Get("uuid")
hereNowShowUUID := q.Get("showUUID")
hereNowIncludeUserState := q.Get("includeUserState")
disableUUID := false
includeUserState := false
if hereNowShowUUID == "1" {
disableUUID = true
}
if hereNowIncludeUserState == "1" {
includeUserState = true
}
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
//c := context.NewContext(r)
c := createContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
go pubInstance.HereNow(c, w, r, channel, disableUUID, includeUserState, successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "HereNow")
}
开发者ID:pubnub,项目名称:go,代码行数:25,代码来源:main.go
示例3: revokeSubscribe
func revokeSubscribe(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
ch := q.Get("ch")
uuid := q.Get("uuid")
c := appengine.NewContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
go pubInstance.GrantSubscribe(c, w, r, ch, false, false, 0, successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Revoke Subscribe")
}
开发者ID:kiran-mk,项目名称:go,代码行数:11,代码来源:main.go
示例4: auditPresence
func auditPresence(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
ch := q.Get("ch")
uuid := q.Get("uuid")
//c := context.NewContext(r)
c := createContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
go pubInstance.AuditPresence(c, w, r, ch, "", successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Audit Presence")
}
开发者ID:pubnub,项目名称:go,代码行数:12,代码来源:main.go
示例5: whereNow
func whereNow(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
whereNowUUID := q.Get("whereNowUUID")
uuid := q.Get("uuid")
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
c := appengine.NewContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
go pubInstance.WhereNow(c, w, r, whereNowUUID, successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "WhereNow")
}
开发者ID:kiran-mk,项目名称:go,代码行数:13,代码来源:main.go
示例6: deleteUserState
func deleteUserState(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
ch := q.Get("ch")
key := q.Get("k")
uuid := q.Get("uuid")
c := appengine.NewContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
go pubInstance.SetUserStateKeyVal(c, w, r, ch, key, "", successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Del User State")
}
开发者ID:kiran-mk,项目名称:go,代码行数:13,代码来源:main.go
示例7: 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
}
// ctx := context.NewContext(r)
ctx := createContext(r)
pubInstance := messaging.New(ctx, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
go pubInstance.History(ctx, w, r, ch, iLimit, iStart, iEnd, bReverse, successChannel, errorChannel)
handleResult(ctx, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Detailed History")
}
开发者ID:pubnub,项目名称:go,代码行数:49,代码来源:main.go
示例8: publish
func publish(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
message := q.Get("m")
uuid := q.Get("uuid")
ch := q.Get("ch")
fire := q.Get("fire")
//meta, _ := url.QueryUnescape(q.Get("meta"))
metaKey := q.Get("metakey")
metaVal := q.Get("metaval")
storeInHistory := q.Get("storeInHistory")
storeInHistoryBool := false
if storeInHistory == "1" {
storeInHistoryBool = true
}
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
meta := make(map[string]string)
if strings.TrimSpace(metaKey) != "" && strings.TrimSpace(metaVal) != "" {
meta[metaKey] = metaVal
} else {
meta = nil
}
//c := context.NewContext(r)
c := createContext(r)
/*message1 := make(map[string]string)
message1["author"] = "user-a"
message1["status"] = "I am reading about Advanced Channel Groups!"
message1["timestamp"] = time.Now().String()*/
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
//go pubInstance.Publish(c, w, r, "my_channel", message1, successChannel, errorChannel)
if fire == "1" {
go pubInstance.Fire(c, w, r, ch, message, false, successChannel, errorChannel)
} else if meta != nil {
log.Infof(c, fmt.Sprintf("Meta: %s", meta))
go pubInstance.PublishExtendedWithMeta(c, w, r, ch, message, meta, storeInHistoryBool, false, successChannel, errorChannel)
} else if storeInHistoryBool {
go pubInstance.PublishExtended(c, w, r, ch, message, storeInHistoryBool, false, successChannel, errorChannel)
} else {
go pubInstance.Publish(c, w, r, ch, message, successChannel, errorChannel)
}
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Publish")
}
开发者ID:pubnub,项目名称:go,代码行数:48,代码来源:main.go
示例9: setUserState
func setUserState(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
ch := q.Get("ch")
k := q.Get("k")
v := q.Get("v")
uuid := q.Get("uuid")
//c := context.NewContext(r)
c := createContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
//setUserState
go pubInstance.SetUserStateKeyVal(c, w, r, ch, k, v, successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Set User State")
}
开发者ID:pubnub,项目名称:go,代码行数:17,代码来源:main.go
示例10: PublishMessages
// PublishMessages calls the publish method of messaging package numberOfMessages times
// and appends the count with the message to distinguish from the others.
//
// Parameters:
// pubnubInstance: a reference of *messaging.Pubnub,
// channel: the pubnub channel to publish the messages,
// t: a reference to *testing.T,
// startMessagesFrom: the message identifer,
// numberOfMessages: number of messages to send,
// message: message to send.
//
// returns a bool if the publish of all messages is successful.
func PublishMessages(context context.Context, w http.ResponseWriter, r *http.Request, pubnubInstance *messaging.Pubnub, channel string, t *testing.T, startMessagesFrom int, numberOfMessages int, message string) bool {
messagesReceived := 0
messageToSend := ""
tOut := messaging.GetNonSubscribeTimeout()
messaging.SetNonSubscribeTimeout(30)
for i := startMessagesFrom; i < startMessagesFrom+numberOfMessages; i++ {
messageToSend = message + strconv.Itoa(i)
returnPublishChannel := make(chan []byte)
errorChannel := make(chan []byte)
go pubnubInstance.Publish(context, w, r, channel, messageToSend, returnPublishChannel, errorChannel)
messagesReceived++
//time.Sleep(500 * time.Millisecond)
time.Sleep(1500 * time.Millisecond)
}
if messagesReceived == numberOfMessages {
return true
}
messaging.SetNonSubscribeTimeout(tOut)
return false
}
开发者ID:GleasonK,项目名称:go,代码行数:34,代码来源:pubnubDetailedHistory_test.go
示例11: getUserState
func getUserState(w http.ResponseWriter, r *http.Request) {
/*successChannel := make(chan []byte)
errorChannel := make(chan []byte)
c := createContext(r)
pubInstance := messaging.New(c, "", w, r, publishKey, subscribeKey, secretKey, "", false)
go pubInstance.ChannelGroupAddChannel(c, w, r, "cg-user-a-friends", "ch-user-a-present", successChannel, errorChannel)
select {
case response := <-successChannel:
log.Infof(c, "success:", string(response))
case err := <-errorChannel:
log.Infof(c, "success:", string(err))
}
go pubInstance.ChannelGroupAddChannel(c, w, r, "cg-user-a-status-feed", "ch-user-a-present", successChannel, errorChannel)
select {
case response := <-successChannel:
log.Infof(c, "1success:", string(response))
case err := <-errorChannel:
log.Infof(c, "1success:", string(err))
}*/
q := r.URL.Query()
ch := q.Get("ch")
uuid := q.Get("uuid")
//c := context.NewContext(r)
c := createContext(r)
pubInstance := messaging.New(c, uuid, w, r, publishKey, subscribeKey, secretKey, "", false)
errorChannel := make(chan []byte)
successChannel := make(chan []byte)
go pubInstance.GetUserState(c, w, r, ch, successChannel, errorChannel)
handleResult(c, w, r, uuid, successChannel, errorChannel, messaging.GetNonSubscribeTimeout(), "Get User State")
}
开发者ID:pubnub,项目名称:go,代码行数:36,代码来源:main.go
注:本文中的github.com/pubnub/go/gae/messaging.GetNonSubscribeTimeout函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论