serve abstract method

void serve(
  1. StreamChannel<Object?> channel, {
  2. bool serialize = true,
})

Starts processing requests from the channel.

The channel uses a drift-internal protocol to serialize database requests. Drift assumes full control over the channel. Manually sending messages over it, or closing it prematurely, can disrupt the server.

If serialize is true, drift will only send bool, int, double, Uint8List, String or List's thereof over the channel. Otherwise, the message may be any Dart object.

After calling serve, you can obtain a DatabaseConnection on the other end of the channel by calling connectToRemoteAndInitialize.

Warning: As long as this library is marked experimental, the protocol might change with every drift version. For this reason, make sure that your server and clients are using the exact same version of the drift package to avoid conflicts.

Implementation

void serve(StreamChannel<Object?> channel, {bool serialize = true});