CasperX
CasperX
HHono
Created by CasperX on 10/22/2024 in #help
are there any way to check whether route exists in the router or not?
i want to create more strict WebSocket adapter for Hono on Node. the current one @hono/node-ws upgrade every websocket connection even if route isn't exists. i want to reject those connections. are there any reliable way to check whether route exists in router or not? even if onError or onNotFound handler has been set up to return success response. my current solution to reject invalid websocket connection is to set up catch all route, added it as the last handler and in onOpen callback, close those unwanted connection. this works fine, but it would be better if it reject the connection from beginning instead of upgrade it and then close it later.
1 replies