コード例 #1
0
ファイル: chat_example.go プロジェクト: itmarketplace/rhynock
// Satisfy the BottleDst interface
func (r *Router) ConnectionOpened(c *rhynock.Conn) {
	// This should put the connection into an authenticating mode
	// and then upon authentication the connection is added to a map
	// where the value points at some kind of profile object
	// can all c.Close() upon failing to authenticate
	c.SendMsg("Welcome to echochat. No names. No rules.")
	r.connections[c] = true
}
コード例 #2
0
ファイル: auth_example.go プロジェクト: itmarketplace/rhynock
// Satisfy the BottleDst interface
func (r *Router) ConnectionOpened(c *rhynock.Conn) {
	// Create an empty profile for them
	r.connections[c] = &Profile{}

	// Welcome them
	c.SendMsg("Welcome to authchat we hope you enjoy your stay")
	c.SendMsg("Please login below")
	c.SendMsg("#################################################")

	// Send them a login prompt
	c.SendMsg("Enter your username")
}