推送系统 go库 Centrifugo

该库定义了必须通过各种传输(Websocket、SockJS)发送的自定义协议和消息类型。服务器客户端在内部使用该协议,并为特性提供简单的API——建立持久连接、订阅通道、调用RPC命令等等。

./centrifugo genconfig生成配置文件 config.json
./centrifugo genconfig -c config.yaml
./centrifugo checkconfig --config=config.yaml
./centrifugo --config=config.yaml
最简单的配置只需要两个字段secret和api_key

Some of the most important options you can configure when running Centrifugo:

address – bind your Centrifugo to specific interface address (by default “”)
port – port to bind Centrifugo to (by default 8000)
engine – engine to use - memory or redis (by default memory). Read more about engines in special chapter.

./centrifugo --config=config.yaml --address=127.0.0.1 --port=8000 --engine=redis --redis_host=127.0.0.1 --redis_port=6379

{
“debug”: true,
“port”: 900,
“secret”: “my-secret-key”,
“api_key”: “secret-api-key”,
“anonymous”: true,
“publish”: true,
“subscribe_to_publish”: true,
“presence”: true,
“join_leave”: true,
“history_size”: 10,
“history_lifetime”: 300,
“history_recover”: true
}

默认三个可用的端点
原始websocket
ws://localhost:8000/connection/websocket

然后是SockJS端点——它需要服务使用SockJS库的客户端连接:http://localhost:8000/connection/sockjs

最后,您还有API端点来发布消息到通道(并执行其他可用的API命令):
http://localhost:8000/api

debug
http://localhost:8000/debug/pprof/

https://godoc.org/github.com/centrifugal/centrifuge-go
https://godoc.org/github.com/centrifugal/gocent
https://github.com/centrifugal/centrifuge-js

Centrifugo 是一个用 Golang 实现的基于 Websocket 或者 SockJS 的实时通信平台。支持数千个同时连接,提供基于频道的出版/订阅模式。PUB/SUB容易和现有系统集成– 不改变已有后端情况下为系统提供实时通信能力。HTTP API 和已有后端通信 . API clients for Python, Ruby, PHP, Go, NodeJS.浏览器可以通过SockJS或者纯粹Websocket协议和centrifugal通信. 提供 iOS和Android平台SDK采用Redis实现分布式部署.SHA-256 HMAC连接认证和隐私保护多种类型的频道 – 私有, 用户限制,客户端限制通过名字空间灵活配置频道支持即时消息和历史消息支持用户加入/离开消息网络重连后可以恢复消息内置管理界面,提供多种计量(Metrics)可用于WebRTC信令服务器多种部署手段(docker 镜像, RPM/DEB 包, Nginx 配置, TLS certificates)MIT license通讯模型:Centrifugo 包含如下子项目:centrifugo - 采用 Go 语言开发的实时消息传递服务器centrifuge-js - Javascript 客户端,可直接在浏览器使用centrifuge-android - Android 的客户端开发包,可通过 WebSockets 与服务器通讯centrifuge-ios - Swift 开发包centrifuge-go - Go 客户端开发包cent - Python 开发包adjacent - Cent 的小型封装包,简化了与 Django 框架的集成rubycent - Ruby gem to communicate  with Centrifugo server API.phpcent - PHP client to communicate  with Centrifugo server API.gocent - Go client to communicate  with Centrifugo server API.jscent - NodeJS client to communicate  with Centrifugo server API.web - Centrifugo 的管理界面,基于 ReactJS 开发 标签:Centrifugo
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

InterestingFigure

迈克 Let's Go

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值