Skip to content

Handshake is required #1

@danelowe

Description

@danelowe

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions