webSocketListener

Importing

import { webSocketListener } from '@marblejs/websockets';

Type declaration

webSocketListener :: WebSocketListenerConfig -> WebSocket.ServerOptions -> ContextReader

Parameters

parameter

definition

config

WebSocketListenerconfig

WebSocketListenerConfig

parameter

definition

effects

<optional> Array<WsEffect>

middlewares

<optional> Array<WsMiddlewareEffect>

error$

<optional> WsErrorEffect

connection$

<optional> WsConnectionEffect

output$

<optional> WsOutputEffect

eventTransformer

<optional> EventTransformer

Example

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$],
});