pubsub

package
v0.0.0-...-20ea542 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PullMsgs

func PullMsgs(info PubSubInfo, channelMap *map[string](chan Notice))

PullMsgs pulls messages from a Google Cloud Pub/Sub subscription and sends them to the corresponding user's channel in the channelMap. It takes in a PubSubInfo struct containing the project ID and subscription ID, a pointer to a map containing user IDs and their corresponding channels, and a context for cancellation. It returns nothing.

Types

type Notice

type Notice struct {
	UserId string `json:"userId"`
	Msg    string `json:"msg"`
}

type PubSubInfo

type PubSubInfo struct {
	ProjectID string
	ChannelId string
	TopicID   string
	SubID     string
	Topic     *pubsub.Topic
	Sub       *pubsub.Subscription
	Client    *pubsub.Client
}

func (*PubSubInfo) Init

func (info *PubSubInfo) Init(projectId string) error

func (*PubSubInfo) Release

func (info *PubSubInfo) Release() error

Jump to

Keyboard shortcuts

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