Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.07 KB

websocketlistener.md

File metadata and controls

46 lines (34 loc) · 1.07 KB

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

{% 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 %}