Documentation ¶
Overview ¶
Package ssredis provides a ss.MultihomeBackend interface that uses Redis for synchronizing broadcasts and roomcasts between multiple Sacrificial Socket instances.
Index ¶
Constants ¶
const (
//the default redis.PubSub channel that will be subscribed to
DefServerGroup = "ss-rmhb-group-default"
)
Variables ¶
var ( ErrBadDataType = errors.New("bad data type") ErrNoEventName = errors.New("no event name") )
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { //ServerName is a unique name for the ss.MultihomeBackend instance. //This name must be unique per backend instance or the backend //will not broadcast and roomcast properly. // //Leave this name blank to auto generate a unique name. ServerName string //ServerGroup is the server pool name that this instance's broadcasts //and roomcasts will be published to. This can be used to break up //ss.MultihomeBackend instances into separate domains. // //Leave this empty to use the default group "ss-rmhb-group-default" ServerGroup string }
type RMHB ¶
type RMHB struct {
// contains filtered or unexported fields
}
RMHB implements the ss.MultihomeBackend interface and uses Redis to syncronize between multiple machines running ss.SocketServer
func NewBackend ¶
NewBackend creates a new *RMHB specified by redis Options and ssredis Options
func (*RMHB) BroadcastFromBackend ¶
func (r *RMHB) BroadcastFromBackend(bc chan<- *ss.BroadcastMsg)
BroadcastFromBackend will receive broadcast messages from redis and propogate them to the neccessary sockets
func (*RMHB) BroadcastToBackend ¶
func (r *RMHB) BroadcastToBackend(b *ss.BroadcastMsg)
BroadcastToBackend will publish a broadcast message to the redis backend
func (*RMHB) Init ¶
func (r *RMHB) Init()
Init is just here to satisfy the ss.MultihomeBackend interface.
func (*RMHB) RoomcastFromBackend ¶
RoomcastFromBackend will receive roomcast messages from redis and propogate them to the neccessary sockets
func (*RMHB) RoomcastToBackend ¶
RoomcastToBackend will publish a roomcast message to the redis backend