package
Version:
v0.0.0-...-9fc3494
Opens a new window with list of versions in this module.
Published: Nov 5, 2019
License: MIT
Opens a new window with license information.
Imports: 17
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Comet is a comet.
NewComet new a comet.
每个 comet 对象会启动多个 goroutine,并发的将消息推送到本 comet svr 上。
Broadcast broadcast a message.
全局广播消息推送。
BroadcastRoom broadcast a room message.
单房间消息推送,逻辑同上。
Close close the resouces.
关闭其他正在执行的 goroutine(很像没用到)。
Push push a user message.
单人消息推送需要交由某个负责单人消息推送的 goroutine 来处理, Comet 内会预先开启多个 goroutine ,
每个 goroutine 内都有一个用于单人消息推送的 chan ,这里用 原子锁 + 序号自增(轮循)的方式选择一个 goroutine,
让其负责消息发送。
Job is push job.
Consume messages, watch signals
【主逻辑】接收 kafka 的消息,如果是单用户消息就发送给指定 comet,单房间广播和全局广播就发送给所有的 comet 。
Room room.
NewRoom new a room struct, store channel room info.
Push push msg to the room, if chan full discard it.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.