S
S
s2sk13372017-05-30 05:44:21
PHP
s2sk1337, 2017-05-30 05:44:21

How to make friends PHP and Socket IO to the end?

Hi all. Found such library elephant.io for PHP which connects it with Node JS server with Socket IO. Everything is set up and working. But I can't figure out how to read what came from the server... Sending is simple:

$version = new Version1X("http://localhost:7777");

$client = new Client($version);

$client->initialize();
$client->emit("new_message", ["Text"=>"Текст"]);

But reading ... I tried to make a simple function and call it on the server:
io.emit("NEW_MESSAGE", "text");
function NEW_MESSAGE(data)
{
   echo data;
}

But this didn’t work ...
I immediately say that regular JS on the client is not suitable, I want to make private messages and even I’m afraid for security, there’s the client side, you can change anything ...
Now, if that page on the github https:// github.com/shubhamparamhans/elephant.io

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2017-05-30
@Sanasol

I say right away that regular JS on the client is not suitable

use websocket to communicate with it from the backend? well, then throw out the websocket, you don't need it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question