pubsub

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName = "PublishSubscribeService"
)

Variables

This section is empty.

Functions

func RegisterService

func RegisterService()

RegisterService registeres PublishSubscribeService to goworld

Types

type PublishSubscribeService

type PublishSubscribeService struct {
	entity.Entity
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL