Skip to content

[BUG] PocketOptionAsync Connection Initialization Timeout #99

@devflex-pro

Description

@devflex-pro

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions