Skip to content

Instantly share code, notes, and snippets.

@Guley
Created March 9, 2020 03:51
Show Gist options
  • Save Guley/624408f339af685ec14d31c9ace0b771 to your computer and use it in GitHub Desktop.
Save Guley/624408f339af685ec14d31c9ace0b771 to your computer and use it in GitHub Desktop.
Socket ElephantIO header over SSL
<?php
require __DIR__ . '/vendor/autoload.php';
use ElephantIO\Client;
use ElephantIO\Engine\SocketIO\Version2X;
$options = [
'context' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
],
'http' => [
'header'=>[
'token: xxxxxx'
],
]
]
];
$client = new Client(new Version2X('https://localhost:1337',$options));
$client->initialize();
// send message to connected clients
$client->emit('broadcast', ['type' => 'notification', 'text' => 'Hello There!']);
$client->close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment