ReverbFake constructor
ReverbFake({
- String namespace = r'App\Events',
- void onError(
- Object error,
- StackTrace? stackTrace
Creates a fake and its client.
namespace matches the Reverb constructor's, so an application that
configures a custom event namespace can mirror it here.
onError surfaces client-side failures the same way the Reverb
constructor's onError does. Pass it in tests that need to notice a
client-side error — without it, a failure the client handled internally
(for example, a reconnect that cannot complete) is invisible: nothing
throws, nothing fails the test, the listener under test simply never
fires.
Implementation
ReverbFake({
String namespace = r'App\Events',
void Function(Object error, StackTrace? stackTrace)? onError,
}) {
_reverb = buildTestReverb(
host: 'localhost',
port: 8080,
appKey: 'fake',
useTls: false,
namespace: namespace,
handleAppLifecycle: false,
authorizer: (String channel, String socketId) async =>
const ReverbAuth(auth: 'fake:signature'),
socketFactory: _connectSocket,
onError: onError,
);
}