Server class

Handling incoming calls and routing them to the correct Endpoint methods.

Implemented types

Constructors

Server({required Serverpod serverpod, required String serverId, required int port, required SerializationManager serializationManager, required DatabasePoolManager? databasePoolManager, required Map<String, String> passwords, required String runMode, String? name, required Caches caches, SecurityContext? securityContext, List<String>? whitelistedExternalCalls, required EndpointDispatch endpoints, required Headers httpResponseHeaders, required Headers httpOptionsResponseHeaders})
Creates a new Server object.

Properties

authenticationHandler AuthenticationHandler
AuthenticationHandler responsible for authenticating users.
no setter
caches → Caches
Caches used by the server.
final
endpoints EndpointDispatch
Responsible for dispatching calls to the correct Endpoint methods.
final
hashCode int
The hash code for this object.
no setterinherited
httpOptionsResponseHeaders Headers
HTTP headers used for OPTIONS responses. These headers are sent in addition to the httpResponseHeaders when the request method is OPTIONS.
final
httpResponseHeaders Headers
HTTP headers used by all API responses. Defaults to allowing any cross origin resource sharing (CORS).
final
messageCentral MessageCentral
Central message dispatch for real time messages.
getter/setter pair
name String
The name of the server.
final
passwords Map<String, String>
Map of passwords loaded from config/passwords.yaml
getter/setter pair
port int
Port the server is listening on. Returns the actual port from the running server if available, otherwise returns the configured port.
no setter
runMode String
The ServerpodRunMode the server is running in.
final
running bool
True if the server is currently running.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serializationManager SerializationManager
The SerializationManager used by the server.
final
serverId String
The id of the server. If running in a cluster, all servers need unique ids.
final
serverpod Serverpod
The Serverpod managing the server.
final
whitelistedExternalCalls List<String>?
Currently not in use.
getter/setter pair

Methods

addMiddleware(Middleware middleware) → void
Adds a Middleware to the server
connectionsInfo() Future<ConnectionsInfo>
Returns information about the current connections to the server.
createDatabase(Session session) Database
Creates a new Database object with a connection to the configured database.
injectIn(RelicRouter router) → void
Overwrite this to define how to inject this object in owner.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shutdown() Future<void>
Shuts the server down. Returns a Future that completes when the server is shut down.
start({required AuthenticationHandler authenticationHandler}) Future<bool>
Starts the server. Returns true if the server was started successfully.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited