func NewServer(conf *Config) (*Server, error) {
	rpcsrv := rpc.NewServer()

	mux := http.NewServeMux()
	mux.HandleFunc(HTTPPath, rpcsrv.ServeHTTP)
	mux.Handle(WSPath, rpcsrv.WebsocketHandler(conf.AllowedOrigins))

	httpsrv := &http.Server{
		Addr:    conf.Addr,
		Handler: mux,
	}

	return &Server{
		conf:    conf,
		rpcsrv:  rpcsrv,
		httpsrv: httpsrv,
	}, nil
}
func NewServer(conf *Config) (*Server, error) {
	rpcsrv := rpc.NewServer()

	mux := http.NewServeMux()
	mux.HandleFunc(HTTPPath, rpcsrv.ServeHTTP)
	mux.Handle(WSPath, rpcsrv.WebsocketHandler(conf.AllowedOrigins))

	httpsrv := &http.Server{
		Addr:    conf.Addr,
		Handler: mux,
	}

	return &Server{
		conf:    conf,
		rpcsrv:  rpcsrv,
		httpsrv: httpsrv,
	}, nil
}
// NewServer creates a new UI server.