Skip to content

Commit

Permalink
pin to latest protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed May 14, 2024
1 parent 10379b5 commit 1132a4b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 46 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Library highlights:
* Possibility to register a custom PUB/SUB Broker and PresenceManager implementations
* Option to register custom Transport, like [Centrifugo does with WebTransport](https://centrifugal.dev/docs/transports/webtransport)
* Message recovery mechanism for channels to survive PUB/SUB delivery problems, short network disconnects or node restart
* Cache channels – a way to quickly deliver latest publication from channel history to the client upon subscription
* Delta compression for publications inside a channel to reduce bandwidth usage
* Out-of-the-box Prometheus instrumentation
* Client SDKs for main application environments all following [single behaviour spec](https://centrifugal.dev/docs/transports/client_api) (see list of SDKs below).

Expand Down
2 changes: 1 addition & 1 deletion _examples/custom_broker_nats/natsbroker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (b *NatsBroker) handleClientMessage(subject string, data []byte) error {
if err != nil {
return err
}
_ = b.eventHandler.HandlePublication(channel, &pub, centrifuge.StreamPosition{}, false, nil)
_ = b.eventHandler.HandlePublication(channel, &pub, centrifuge.StreamPosition{}, nil)
case joinPushType:
var info centrifuge.ClientInfo
err := json.Unmarshal(p.Data, &info)
Expand Down
2 changes: 1 addition & 1 deletion _examples/custom_engine_tarantool/tntengine/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ func (b *Broker) handleMessage(eventHandler centrifuge.BrokerEventHandler, msg p
}
}
_ = eventHandler.HandlePublication(
msg.Channel, pub, centrifuge.StreamPosition{Offset: msg.Offset, Epoch: msg.Epoch}, false, nil)
msg.Channel, pub, centrifuge.StreamPosition{Offset: msg.Offset, Epoch: msg.Epoch}, nil)
case "j":
var info protocol.ClientInfo
err := info.UnmarshalVT(msg.Info)
Expand Down
56 changes: 28 additions & 28 deletions _examples/emulation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,34 +81,34 @@ func main() {
LogHandler: handleLog,
})

redisShardConfigs := []centrifuge.RedisShardConfig{
{Address: "localhost:6379"},
}
var redisShards []*centrifuge.RedisShard
for _, redisConf := range redisShardConfigs {
redisShard, err := centrifuge.NewRedisShard(node, redisConf)
if err != nil {
log.Fatal(err)
}
redisShards = append(redisShards, redisShard)
}

broker, err := centrifuge.NewRedisBroker(node, centrifuge.RedisBrokerConfig{
// And configure a couple of shards to use.
Shards: redisShards,
})
if err != nil {
log.Fatal(err)
}
node.SetBroker(broker)

presenceManager, err := centrifuge.NewRedisPresenceManager(node, centrifuge.RedisPresenceManagerConfig{
Shards: redisShards,
})
if err != nil {
log.Fatal(err)
}
node.SetPresenceManager(presenceManager)
//redisShardConfigs := []centrifuge.RedisShardConfig{
// {Address: "localhost:6379"},
//}
//var redisShards []*centrifuge.RedisShard
//for _, redisConf := range redisShardConfigs {
// redisShard, err := centrifuge.NewRedisShard(node, redisConf)
// if err != nil {
// log.Fatal(err)
// }
// redisShards = append(redisShards, redisShard)
//}
//
//broker, err := centrifuge.NewRedisBroker(node, centrifuge.RedisBrokerConfig{
// // And configure a couple of shards to use.
// Shards: redisShards,
//})
//if err != nil {
// log.Fatal(err)
//}
//node.SetBroker(broker)
//
//presenceManager, err := centrifuge.NewRedisPresenceManager(node, centrifuge.RedisPresenceManagerConfig{
// Shards: redisShards,
//})
//if err != nil {
// log.Fatal(err)
//}
//node.SetPresenceManager(presenceManager)

node.OnConnecting(func(ctx context.Context, e centrifuge.ConnectEvent) (centrifuge.ConnectReply, error) {
cred, _ := centrifuge.GetCredentials(ctx)
Expand Down
4 changes: 2 additions & 2 deletions _examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/centrifugal/centrifuge => ../
require (
github.com/FZambia/tarantool v0.2.2
github.com/centrifugal/centrifuge v0.8.2
github.com/centrifugal/protocol v0.12.2-0.20240505100351-eb69a0b95e15
github.com/centrifugal/protocol v0.13.0
github.com/cristalhq/jwt/v5 v5.4.0
github.com/dchest/uniuri v1.2.0
github.com/gin-contrib/sessions v0.0.3
Expand All @@ -30,7 +30,6 @@ require (
)

require (
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
github.com/FZambia/eagle v0.1.0 // indirect
github.com/Yiling-J/theine-go v0.3.2 // indirect
Expand All @@ -42,6 +41,7 @@ require (
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gammazero/deque v0.2.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
Expand Down
12 changes: 2 additions & 10 deletions _examples/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg=
cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40=
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
github.com/FZambia/eagle v0.1.0 h1:9gyX6x+xjoIfglgyPTcYm7dvY7FJ93us1QY5De4CyXA=
Expand All @@ -18,8 +14,8 @@ github.com/bradleypeabody/gorilla-sessions-memcache v0.0.0-20181103040241-659414
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
github.com/centrifugal/protocol v0.12.2-0.20240505100351-eb69a0b95e15 h1:JpdbAUIZwdHB0xc9371SXJEqByEDs/eZ93RcWSqFAoo=
github.com/centrifugal/protocol v0.12.2-0.20240505100351-eb69a0b95e15/go.mod h1:lM54PGU/u5WupYSb755Zv6tZ2ju1SqNKCp6A4s0DeG4=
github.com/centrifugal/protocol v0.13.0 h1:3j9CWlbML5O9OlhLmSPWgptby0hDn4pQC9W+q6UiQQo=
github.com/centrifugal/protocol v0.13.0/go.mod h1:lM54PGU/u5WupYSb755Zv6tZ2ju1SqNKCp6A4s0DeG4=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
Expand Down Expand Up @@ -202,8 +198,6 @@ golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg=
golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8=
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
Expand All @@ -221,8 +215,6 @@ golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
google.golang.org/grpc v1.63.0 h1:WjKe+dnvABXyPJMD7KDNLxtoGk5tgk+YFWN6cBWjZE8=
google.golang.org/grpc v1.63.0/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
Expand Down
2 changes: 1 addition & 1 deletion channel_medium.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (c *channelMedium) CheckPosition(historyMetaTTL time.Duration, clientPositi
}
_, validPosition, err := c.checkPositionWithRetry(historyMetaTTL, clientPosition)
if err != nil {
// Will be checked later.
// Position will be checked again later.
return true
}
if !validPosition {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.21

require (
github.com/FZambia/eagle v0.1.0
github.com/centrifugal/protocol v0.12.2-0.20240505100351-eb69a0b95e15
github.com/Yiling-J/theine-go v0.3.2
github.com/centrifugal/protocol v0.13.0
github.com/google/uuid v1.6.0
github.com/prometheus/client_golang v1.19.0
github.com/redis/rueidis v1.0.36
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/Yiling-J/theine-go v0.3.2 h1:XcSdMPV9DwBD9gqqSxbBfVJnP8CCiqNSqp3C6Ypm
github.com/Yiling-J/theine-go v0.3.2/go.mod h1:ygLXqrWPZT/a+PzK5hQ0+a6gu0lpAY5IudTcgnPleqI=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/centrifugal/protocol v0.12.2-0.20240505100351-eb69a0b95e15 h1:JpdbAUIZwdHB0xc9371SXJEqByEDs/eZ93RcWSqFAoo=
github.com/centrifugal/protocol v0.12.2-0.20240505100351-eb69a0b95e15/go.mod h1:lM54PGU/u5WupYSb755Zv6tZ2ju1SqNKCp6A4s0DeG4=
github.com/centrifugal/protocol v0.13.0 h1:3j9CWlbML5O9OlhLmSPWgptby0hDn4pQC9W+q6UiQQo=
github.com/centrifugal/protocol v0.13.0/go.mod h1:lM54PGU/u5WupYSb755Zv6tZ2ju1SqNKCp6A4s0DeG4=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down

0 comments on commit 1132a4b

Please sign in to comment.