Пример #1
0
// NewServerWith create a new server with given router and root filters
func NewServerWith(rootPath string, rt Router) *Server {
	if rt == nil {
		rt = NewRouter()
	}

	return &Server{
		RootPath: rootPath,

		Router:     rt,
		Attrs:      attrs.NewLocked(),
		components: NewCompManager(),

		hooks: make(map[string][]LifetimeHook),
	}
}
Пример #2
0
// 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(),
	}
}
Пример #3
0
// newSession create a new session with given id
func NewSession(id string) *Session {
	return &Session{
		id:    id,
		Attrs: attrs.NewLocked(),
	}
}