Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Add Socket.IO v2 support #152

Merged
merged 4 commits into from
May 9, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Engine/SocketIO/Version1X.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,17 @@ protected function handshake()
}

/** Upgrades the transport to WebSocket */
private function upgradeTransport()
protected function upgradeTransport()
{
$query = ['sid' => $this->session->id,
'EIO' => $this->options['version'],
'use_b64' => $this->options['use_b64'],
'transport' => static::TRANSPORT_WEBSOCKET];

if ($this->options['version'] === 2)
$query['use_b64'] = $this->options['use_b64'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing braces

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(PSR and all that)


$url = sprintf('/%s/?%s', trim($this->url['path'], '/'), http_build_query($query));
$key = base64_encode(random_bytes(20));
$key = base64_encode(openssl_random_pseudo_bytes(16));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not good either, as it requires openssl. If you absolutely need 20 bytes encoded, you can pass the second argument of sha1 to true, it will generate you a binary digest with a length of 20 bytes,


$origin = '*';
$headers = isset($this->context['headers']) ? (array) $this->context['headers'] : [] ;
Expand Down