The socket.io socket instance
The event name to emit
The data to send with the event
OptionalonSuccess: () => voidOptional callback for successful emission
OptionalonError: (error: any) => voidOptional callback for errors (after retry if applicable)
Wraps a WebSocket emit operation with automatic token refresh on authentication errors. If the socket returns an authentication error, it will attempt to refresh the token and retry the operation once.