listen abstract method

void listen(
  1. void onRequest(
    1. Request request
    ), {
  2. Function? onError,
  3. void onDone()?,

Listen to the channel for requests. If a request is received, invoke the onRequest function. If an error is encountered while trying to read from the socket, invoke the onError function. If the socket is closed by the client, invoke the onDone function. Only one listener is allowed per channel.


void listen(void Function(Request request) onRequest,
    {Function? onError, void Function()? onDone});