BinaryOptionsTools-v2 icon indicating copy to clipboard operation
BinaryOptionsTools-v2 copied to clipboard

[BUG] PocketOptionAsync Connection Initialization Timeout

Open devflex-pro opened this issue 6 months ago • 2 comments

Summary

PocketOptionAsync fails during client initialization with a valid-looking 42["auth", ...] SSID. The error happens outside the bot application, in a minimal standalone script.

Environment

  • OS: Linux
  • Python: 3.14
  • Package: binaryoptionstoolsv2
  • Import path: BinaryOptionsToolsV2.pocketoption

Minimal Reproduction

import asyncio
import time

from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync

SSID = '42["auth",{"session":"...","isDemo":1,"uid":131021432,"platform":3,"isFastHistory":true,"isOptimized":true}]'


async def main() -> None:
    started_at = time.monotonic()
    try:
        print("creating client")
        client = PocketOptionAsync(
            SSID,
            config={
                "connection_initialization_timeout_secs": 15,
                "timeout_secs": 15,
                "terminal_logging": True,
                "log_level": "DEBUG",
            },
        )
        print("client created", round(time.monotonic() - started_at, 2))

        print("waiting assets")
        await client.wait_for_assets(timeout=15)
        print("assets loaded", round(time.monotonic() - started_at, 2))

        print("getting balance")
        balance = await client.balance()
        print("balance", balance)
    except Exception as exc:
        print("ERROR", type(exc).__name__, str(exc))
        print("elapsed", round(time.monotonic() - started_at, 2))


if __name__ == "__main__":
    asyncio.run(main())

Actual Result

creating client
ERROR ValueError PocketOptionError, General error: Connection initialization timed out
elapsed 15.0

The exception is raised while constructing PocketOptionAsync(...), before wait_for_assets() or balance() are called.

Expected Result

The client should either connect successfully or return a more specific error, for example:

  • invalid or expired SSID;
  • authentication rejected;
  • region unavailable;
  • proxy/connectivity error;
  • Socket.IO/WebSocket handshake error.

Additional Notes

  • The same timeout happens with platform: 2 and platform: 3.
  • The same timeout happens with and without proxy environment variables.
  • A minimal auth payload without uid fails immediately with a parse error, so the provided full 42["auth", ...] payload is at least accepted by the parser.
  • HTTPS access to api-eu.po.market and demo-api-eu.po.market responds from the same machine, so this does not look like a simple DNS/route failure.

devflex-pro avatar May 07 '26 14:05 devflex-pro

Hello! @Rick-29 or @sixtysixx Could you please help us with this

theshadow76 avatar May 28 '26 17:05 theshadow76

Please reinstall the latest library, this should be fixed

sixtysixx avatar May 29 '26 05:05 sixtysixx