Created
March 9, 2020 03:51
-
-
Save Guley/624408f339af685ec14d31c9ace0b771 to your computer and use it in GitHub Desktop.
Socket ElephantIO header over SSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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