示例#1
0
文件: server.go 项目: fanbuchi/zerver
// NewServerWith create a new server with given router and root filters
func NewServerWith(rt Router, filters RootFilters) *Server {
	if filters == nil {
		filters = NewRootFilters(nil)
	}
	if rt == nil {
		rt = NewRouter()
	}

	return &Server{
		Router:           rt,
		Attrs:            attrs.NewLocked(),
		RootFilters:      filters,
		ResMaster:        resource.NewMaster(),
		componentManager: newComponentManager(),
	}
}
示例#2
0
// newSession create a new session with given id
func NewSession(id string) *Session {
	return &Session{
		id:    id,
		Attrs: attrs.NewLocked(),
	}
}