Skip to content

Commit

Permalink
Merge pull request #56 from pubnub/CE-3315-Heartbeat-calls
Browse files Browse the repository at this point in the history
Heartbeat calls: new feature and optimizations
  • Loading branch information
crimsonred committed Dec 18, 2018
2 parents 08735a5 + 015f715 commit 95eafa3
Show file tree
Hide file tree
Showing 87 changed files with 9,246 additions and 3,002 deletions.
16 changes: 13 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---
changelog:
-
changes:
-
text: "Presence Heartbeat call delays itself when a Subscribe call precedes it"
type: improvement
-
text: "Heartbeats per channel"
type: feature
date: Dec 18, 18
version: v4.1.5
-
changes:
-
Expand Down Expand Up @@ -232,6 +242,8 @@ features:
- PRESENCE-GET-STATE
- PRESENCE-SET-STATE
- PRESENCE-HEARTBEAT
- PRESENCE-HEARTBEAT-ON-DEMAND
- PRESENCE-HEARTBEAT-THROTTLED
- PRESENCE-HERE-NOW-REFRESH
publish:
- PUBLISH-STORE-FLAG
Expand Down Expand Up @@ -282,8 +294,6 @@ scm: github.com/pubnub/go
supported-platforms:
-
editors:
- "1.7.6"
- "1.8.7"
- "1.9.7"
- "1.10.3"
- "1.11.1"
Expand All @@ -293,4 +303,4 @@ supported-platforms:
- "Mac OS X 10.8 or later, amd64"
- "Windows 7 or later, amd64, 386"
version: "PubNub Go SDK"
version: v4.1.4
version: v4.1.5
22 changes: 12 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
language: go

go:
- 1.7.6
- 1.8.7
- 1.9.7
- 1.10.3
- 1.11.1
- 1.11.4
- master
- tip

env:
- DEP_VERSION=0.5.0

matrix:
allow_failures:
- go: tip
fast_finish: true
go_import_path: github.com/pubnub/go

before_install:
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep

install:
- mkdir -p $GOPATH/src/github.com/pubnub
- go get golang.org/x/net/context
- go get github.com/wadey/gocovmerge
- go get github.com/stretchr/testify
- go get github.com/satori/go.uuid
- go get golang.org/x/text/secure/bidirule
- go get golang.org/x/text/unicode/bidi
- go get golang.org/x/text/unicode/norm
- dep ensure
- dep status
- go get -u github.com/wadey/gocovmerge

script:
- bash ./scripts/run-tests.sh
Expand Down
31 changes: 18 additions & 13 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@

[[constraint]]
name = "github.com/satori/go.uuid"
version = "1.1.0"
version = "1.2.0"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.0"
version = "1.2.2"

[[constraint]]
branch = "master"
name = "golang.org/x/net"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# PubNub 4.1.4 client for Go
* Go (1.7.6+)
# PubNub 4.1.5 client for Go
* Go (1.9+)

# Please direct all Support Questions and Concerns to Support@PubNub.com

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.4
4.1.5
26 changes: 26 additions & 0 deletions examples/cli/cli_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func showHelp() {
showGrantHelp()
showSubscribeWithStateHelp()
showPresenceTimeoutHelp()
showPresenceHelp()
fmt.Println("")
fmt.Println("================")
fmt.Println(" || COMMANDS ||")
Expand Down Expand Up @@ -282,6 +283,12 @@ func showPresenceTimeoutHelp() {
fmt.Println(" setpto 120 59")
}

func showPresenceHelp() {
fmt.Println(" Presence: ")
fmt.Println(" presence Connected Channels ChannelGroups")
fmt.Println(" presence true my-channel,my-another-channel my-channelgroup,my-another-channel-group")
}

func readCommand(cmd string) {
command := strings.Split(cmd, " ")

Expand Down Expand Up @@ -328,6 +335,8 @@ func readCommand(cmd string) {
publishTest()
case "setpto":
setPresenceTimeout(command[1:])
case "presence":
runPresenceRequest(command[1:])
case "q":
pn.UnsubscribeAll()
case "d":
Expand All @@ -337,6 +346,23 @@ func readCommand(cmd string) {
}
}

func runPresenceRequest(args []string) {
if len(args) < 2 {
showPresenceHelp()
}
var connected bool
connected, _ = strconv.ParseBool(args[0])

var channels []string
channels = strings.Split(args[1], ",")

var groups []string
if len(args) > 2 {
groups = strings.Split(args[2], ",")
}
pn.Presence().Connected(connected).Channels(channels).ChannelGroups(groups).Execute()
}

func setPresenceTimeout(args []string) {
if len(args) < 0 {
showPresenceTimeoutHelp()
Expand Down
Loading

0 comments on commit 95eafa3

Please sign in to comment.