This repository has been archived by the owner on Aug 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 366
This socket.io server do not support websocket protocol. Terminating connection... #2
Comments
Can you please post the exception you had ? |
PHP 5.4.6-1ubuntu1 (cli) (built: Aug 22 2012 21:13:52) |
Hi @Pitel , thanks for tryin' elephant.io! We updated a bit the lib (2.0 tag) and unfortunately did not update the doc accordingly.. Could you please try these code parts and tell me if it works for you? PHP Code trying to communicate with socket.io through PHP: <?php
require('lib/ElephantIO/Client.php');
use ElephantIO\Client as ElephantIOClient;
$elephant = new ElephantIOClient('http://localhost:8000', 'socket.io', 1, false, true, true);
$elephant->init();
$elephant->send(
ElephantIOClient::TYPE_EVENT,
null,
null,
json_encode(array('name' => 'action', 'args' => 'foo'))
);
$elephant->close();
echo 'tryin to send `foo` to the event called action'; Node.js server var io = require('socket.io').listen(8000);
io.sockets.on('connection', function (socket) {
console.log('user connected');
socket.on('action', function (data) {
console.log('here we are in action event and data is: ');
console.log(data);
});
}); |
Oops, my bad. It seems PHP does not allow settings parameters like Python. Removing |
how to remove $debug = true. I can fix this issue |
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The following code ends with this exception:
But it's not true! The following JS code works just fine in browser, and I am sure (from Chrome dev tools) it uses websocket protocol:
And here is the Node.js server:
So why am I getting the above exception?
The text was updated successfully, but these errors were encountered: