Implement websocket server

This commit is contained in:
2022-07-14 01:15:16 -05:00
parent dc663ec8f5
commit 33a64b99ff
15 changed files with 546 additions and 27 deletions

View File

@@ -9,6 +9,7 @@ import {RouteGroup} from './RouteGroup'
import {Config} from '../../service/Config'
import {Application} from '../../lifecycle/Application'
import {Logging} from '../../service/Logging'
import {WebSocketBus} from '../../support/bus/WebSocketBus'
/**
* Type alias for an item that is a valid response object, or lack thereof.
@@ -140,8 +141,8 @@ export class Route<TReturn extends ResponseObject, THandlerParams extends unknow
* Create a new WebSocket route on the given endpoint.
* @param endpoint
*/
public static socket(endpoint: string): Route<void, [void]> {
return new Route<void, [void]>('ws', endpoint)
public static socket(endpoint: string): Route<Awaitable<void>, [WebSocketBus]> {
return new Route<Awaitable<void>, [WebSocketBus]>('ws', endpoint)
}
/**