import { webSocketListener } from '@marblejs/websockets';
webSocketListener :: WebSocketListenerConfig -> WebSocket.ServerOptions -> ContextReader
parameter | definition |
---|---|
config | WebSocketListenerconfig |
parameter | definition |
---|---|
effects | <optional> Array<WsEffect> |
middlewares | <optional> Array<WsMiddlewareEffect> |
error$ | <optional> WsErrorEffect |
connection$ | <optional> WsConnectionEffect |
output$ | <optional> WsOutputEffect |
eventTransformer | <optional> EventTransformer |
{% code title="websocket.listener.ts" %}
import { webSocketListener } from '@marblejs/websockets';
import { example$ } from './example.effect';
import { logger$ } from './logger.middleware';
export default webSocketListener({
middlewares: [logger$],
effects: [add$],
});
{% endcode %}