Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PubSub ¶
type PubSub struct { // Represents the P2P Host for the PubSub Host *p2p.P2P // Represents the channel of incoming messages Inbound chan chatmessage // Represents the channel of outgoing messages Outbound chan string // Represents the channel of chat log messages Logs chan chatlog // Represents the client of the chat room ClientName string // Represent the topic of the user in the chat room TopicName string // contains filtered or unexported fields }
A structure that represents a PubSub Chat Room
func JoinPubSub ¶
A constructor function that generates and returns a new PubSub for a given P2PHost, username and roomname
func Sub ¶
func Sub(local *RESPHandle.WriterHandle, topicName string) (*PubSub, error)
func (*PubSub) Exit ¶
func (cr *PubSub) Exit()
A method of PubSub that updates the chat room by subscribing to the new topic
func (*PubSub) PubLoop ¶
func (cr *PubSub) PubLoop()
A method of PubSub that publishes a chatmessage to the PubSub topic until the pubsub context closes
func (*PubSub) SubLoop ¶
func (cr *PubSub) SubLoop()
A method of PubSub that continously reads from the subscription until either the subscription or pubsub context closes. The recieved message is parsed sent into the inbound channel
func (*PubSub) UpdateUser ¶
A method of PubSub that updates the chat user name
Click to show internal directories.
Click to hide internal directories.