Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handshake is required #1

Open
danelowe opened this issue Aug 16, 2019 · 2 comments
Open

Handshake is required #1

danelowe opened this issue Aug 16, 2019 · 2 comments
Assignees

Comments

@danelowe
Copy link

Crossbar router would give me an error "invalid magic byte (octet 1) in opening handshake: was 0x{magic}, but expected 0x7f" when attempting to use RawSocketClientTransportProvider

WAMP protocol requires a handshake with 0x7f followed by an octet that specifies max message size and serialization format.

I got it to work by modifying startTransportProvider:

    public function startTransportProvider(ClientInterface $client, LoopInterface $loop)
    {
        $this->client = $client;
        $this->loop   = $loop;
        $connector    = $this->connector ?: new Connector($loop);
        $connector->connect($this->address . ':' . $this->port)->then(function (ConnectionInterface $connection) {
            $connection->write(pack('C4', 0x7f, 0xf1, 0x0, 0x0));
            $this->handleConnection($connection);
            $connection->on('data', [$this, 'handleData']);
            $connection->on('close', [$this, 'handleClose']);
        }, 'printf');
    }

Not sure I know enough at this time to do a PR

@mbonneau
Copy link
Member

@danelowe Thanks for the code snippet - I believe the raw socket support may not be compatible because the raw socket was implemented while the spec was under heavy revision.

I will take another look at this and see if I can figure out a way to work with both the old raw socket implementation and the way the spec is now.

@danelowe
Copy link
Author

danelowe commented Aug 16, 2019 via email

@mbonneau mbonneau self-assigned this Aug 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants