fastify / fastify-websocket

basic websocket support for fastify
MIT License
394 stars 72 forks source link

preClose not typed #285

Closed sebasptsch closed 8 months ago

sebasptsch commented 8 months ago

Prerequisites

Fastify version

4.13.0

Plugin version

8.x

Node.js version

21.x

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

Win 11/WSL 20.04

Description

I'm trying to broadcast a reconnect notification before the client/server connection is closed for use with TRPC Fastify Plugin but the preClose option isn't typed.

Steps to Reproduce

  1. Install Fastify, TRPC (server and fastify plugin) and Fastify Websocket in TS Environment
  2. Attempt to add custom onClose method

Expected Behavior

Be able to add an onClose method to the options of fastify websocket.

sebasptsch commented 8 months ago

Seems to be an issue with the dynamic import types, closing for now as it seems to work in the environment if I don't use a dynamic import.