Here is almost complete SOLUTION on stackoverflow to my problem
Problem is communication with my node JS server via PHP. I can't understand one detail in solution above:
compose message 42["message", "your message"]' to encode to hybi10 (or hybi13) and send to websocket
What does that mean? My node js server got "command" new message like this
socket.on('new message', function (data) {
socket.broadcast.emit('new message', {
username: socket.username,
message: data
});
});
Code from solution im using is:
$socketio = new SocketIO();
if ($socketio->send('localhost', 8080, 'message')){
echo 'we sent the message and disconnected';
} else {
echo 'Sorry, we have a mistake :\'(';
}
This code only connects to my server, but how to send "new message" message in correct format? Can't understand this 42["message", "your message"]'