Replies: 1 comment
-
| 
         For any future people curious, you can reference the implementation directly from the middleware definition. At the current time of writing it the full type is: use(fn: (socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>, next: (err?: ExtendedError) => void) => void): this;You can create a simple middleware type for this which will get the corresponding params. Similar approach can be used directly for middleware on the socket instance too. import { Server } from "socket.io";
type MiddlewareFunction = Parameters<Server["use"]>[0];
export const chatAuthHandler: MiddlewareFunction = (socket, next) => {};
// elsewhere in your codebase
const io = new Server();
io.use(chatAuthHandler); | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
What is the typescript type for next in socket IO middleware
For example
How would I type next.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions