export function buildTradingSocketOptions(token: string, socketPath?: string) {
  return {
    transports: ['polling', 'websocket'] as ('polling' | 'websocket')[],
    auth: { token },
    ...(socketPath ? { path: socketPath } : {}),
  };
}

export function isUnauthorizedSocketError(message: string) {
  const normalizedMessage = message.toLowerCase();
  return normalizedMessage.includes('unauthorized') || normalizedMessage.includes('invalid token');
}
