示例#1
0
func (server *Server) Start() {
	var config = new(config.Config)
	ok := config.Parse()

	if ok {
		for key, channel := range config.Channels {
			fmt.Printf("K %s", key)
			http.Handle("/"+channel, websocket.Handler(ChannelHandler))
		}
		err := http.ListenAndServe(":"+config.Port, nil)
		if err != nil {
			panic("ListenAndServe: ", err.String())
		}
	}
}