chatroom

package
v0.0.0-...-340bb57 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chatroom

type Chatroom struct {
	Room
	// contains filtered or unexported fields
}

A Chatroom has all functions and channels to be exported from this package.

func New

func New(topics []Topic) Chatroom

New creates and initialize a Chatroom. This also starts a go-routine to pass messages to Topics.

type DidTalk

type DidTalk bool

A DidTalk means whether the Topic talks with user. A Topic function must return this type value.

type Room

type Room struct {
	In  chan interface{}
	Out chan interface{}
}

A Room has functions to wait or send messages with user. This is passed to Topic function as argument.

type Topic

type Topic func(Room) DidTalk

Topic type is the function express a bunch of flow in chattting. Pass slice of this to New(), and the function called them in order. If one of them returns true, the loop breaks.

Jump to

Keyboard shortcuts

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