Documentation ¶
Index ¶
- Constants
- func RegisterService()
- type PublishSubscribeService
- func (pss *PublishSubscribeService) DescribeEntityType(desc *entity.EntityTypeDesc)
- func (pss *PublishSubscribeService) OnCreated()
- func (pss *PublishSubscribeService) OnFreeze()
- func (pss *PublishSubscribeService) OnInit()
- func (pss *PublishSubscribeService) OnRestored()
- func (pss *PublishSubscribeService) Publish(subject string, content string)
- func (pss *PublishSubscribeService) Subscribe(subscriber common.EntityID, subject string)
- func (pss *PublishSubscribeService) Unsubscribe(subscriber common.EntityID, subject string)
- func (pss *PublishSubscribeService) UnsubscribeAll(subscriber common.EntityID)
Constants ¶
const (
ServiceName = "PublishSubscribeService"
)
Variables ¶
This section is empty.
Functions ¶
func RegisterService ¶
func RegisterService()
RegisterService registeres PublishSubscribeService to goworld
Types ¶
type PublishSubscribeService ¶
PublishSubscribeService is the service entity for maintain total online avatar infos
func (*PublishSubscribeService) DescribeEntityType ¶ added in v0.1.3
func (pss *PublishSubscribeService) DescribeEntityType(desc *entity.EntityTypeDesc)
func (*PublishSubscribeService) OnCreated ¶
func (pss *PublishSubscribeService) OnCreated()
OnCreated is called when PublishSubscribeService is created
func (*PublishSubscribeService) OnFreeze ¶
func (pss *PublishSubscribeService) OnFreeze()
OnFreeze converts all subscribings to entity attrs
func (*PublishSubscribeService) OnInit ¶
func (pss *PublishSubscribeService) OnInit()
OnInit initialize PublishSubscribeService fields
func (*PublishSubscribeService) OnRestored ¶
func (pss *PublishSubscribeService) OnRestored()
OnRestored restores subscribings from entity attrs
func (*PublishSubscribeService) Publish ¶
func (pss *PublishSubscribeService) Publish(subject string, content string)
Publish is called when Avatars login
func (*PublishSubscribeService) Subscribe ¶
func (pss *PublishSubscribeService) Subscribe(subscriber common.EntityID, subject string)
Subscribe subscribe to the specified subject subject can endswith '*' which matches any zero or more characters for example, if an entity subscribe to 'apple.*', it will receive published message on 'apple.', 'apple.1', 'apple.2', etc There can be only one '*' at the end of subject while subscribing, same for unsubscribing
func (*PublishSubscribeService) Unsubscribe ¶
func (pss *PublishSubscribeService) Unsubscribe(subscriber common.EntityID, subject string)
Unsubscribe subscribe to the specified subject
func (*PublishSubscribeService) UnsubscribeAll ¶
func (pss *PublishSubscribeService) UnsubscribeAll(subscriber common.EntityID)
UnsubscribeAll unsubscribes all subjects for the subscriber