-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Hi there,
I've changed the php text to "ws://localhost:8282" as having it as 0.0.0.0 was giving a 10049 error (where as localhost doesn't give any error).
Still it seems to not be working correctly. If I connect via javascript it seems to be working fine, but when I send a message using php I don't get anything.
PHP (not working)
`public function test_webs(){
$socket_client = new WebSocket\Client("ws://0.0.0.0:8282");
$socket_client->send(json_encode(array('user_id' => 1, 'message' => null)));
$socket_client->send(json_encode(array('user_id' => 1, 'message' => 'Super cool message to myself!')));
}`
javascript (working fine)
`var conn = new WebSocket('ws://localhost:8282');
var client = {
user_id: 5,
recipient_id: null,
type: 'socket',
token: null,
message: null
};
conn.onopen = function (e) {
conn.send(JSON.stringify(client));
console.log("Socket open");
};
conn.onmessage = function (e) {
var data = JSON.parse(e.data);
if (data.message) {
console.log("Incomming User "+data.user_id+": ");
console.log(data.message);
}
if (data.type === 'token') {
// $('#token').html('JWT Token : ' + data.token);
console.log('JWT Token : ' + data.token);
}
};`
Assistance will be appreciated.
Metadata
Metadata
Assignees
Labels
No labels