1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
package clientproto
import (
"github.com/centrifugal/protocol"
)
// NewMessagePush returns initialized async push message.
func NewMessagePush(data protocol.Raw) *protocol.Push {
return &protocol.Push{
Type: protocol.PushTypeMessage,
Data: data,
}
}
// NewPublicationPush returns initialized async publication message.
func NewPublicationPush(ch string, data protocol.Raw) *protocol.Push {
return &protocol.Push{
Type: protocol.PushTypePublication,
Channel: ch,
Data: data,
}
}
// NewJoinPush returns initialized async join message.
func NewJoinPush(ch string, data protocol.Raw) *protocol.Push {
return &protocol.Push{
Type: protocol.PushTypeJoin,
Channel: ch,
Data: data,
}
}
// NewLeavePush returns initialized async leave message.
func NewLeavePush(ch string, data protocol.Raw) *protocol.Push {
return &protocol.Push{
Type: protocol.PushTypeLeave,
Channel: ch,
Data: data,
}
}
// NewUnsubPush returns initialized async unsubscribe message.
func NewUnsubPush(ch string, data protocol.Raw) *protocol.Push {
return &protocol.Push{
Type: protocol.PushTypeUnsub,
Channel: ch,
Data: data,
}
}
// NewSubPush returns initialized async subscribe message.
func NewSubPush(ch string, data protocol.Raw) *protocol.Push {
return &protocol.Push{
Type: protocol.PushTypeSub,
Channel: ch,
Data: data,
}
}
|