Reputation: 426
I am in the process of making a chat app. I create accounts, login, select, view and do more already with PHP MySQL. And I am beginning to get into the Instant Messaging side of things.
I am using NodeJS and SocketIO for this and I have got the demo and such running but when attempting to integrate it into my current PHP stack it fails the mysql calls. I believe the problem is the networking but I could be wrong. Some direction or advice would be much appreciated.
User hits index.html > authenticate.js(ajax) > Sessions.php > Redirect to login or load page with data. However the echo data back:
echo "<script type='text/javascript'>
$('#detailsnote').hide();
$('#edituserimage').attr('src','$Image');
$('#editusername').val('$Username');
$('#editfirstname').val('$Firstname');
$('#editlastname').val('$Lastname');
$('#editnickname').val('$Nickname');
$('#editposition').val('$Position');
$('#editmobile').val('$Mobile');
$('#editdob').val('$DOB');
$('#editemail').val('$Email');
$('#userid').val('$UserID');
</script>";
Gets put in a div that handles that data, but instead, it is showing that echo as text.
I could be entirely wrong and can't mix PHP and NODEJS with MYSQL but I thought it would work. So again, any advice is welcome. Even if it is "Re-write the whole thing in NodeJS"
Upvotes: 0
Views: 516
Reputation: 251
you have to use the redis for this. And use redis pub/sub method for it. Like make a channel in redis and publish data through php and subscribe(broadcast) redis data via nodejs and send capture it on browser through (socket.io)
Upvotes: 2
Reputation: 8841
You can't combine php code with node JS code. Node does not understand the echo keyboard.
Upvotes: 2