ws<T> method
Register a websocket handler with hooks
.
Implementation
void ws<T>(String path, Hooks hooks, [Handler<T>? fallback]) {
return get(path, (event) async {
if (await upgrade(event, hooks)) {
return Response(null, status: 101);
}
return fallback?.call(event) ?? Response(null, status: 426);
});
}