javascript - What happens if node js doesn't find a client html file? -


am trying implement push server php application. initial thoughts long keep events called on client let message_view.php file . not have problem of emiting node js events.

but see of tutorial online use dont understood ?

    fs.readfile(__dirname + '/client.html') ...//html files     or      response.sendfile('hello world')  

after have started server. add event , logic follow on client html file supposed on messages_view.php file.

<script src="socket.io/socket.io.js"></script> <script src="http://code.jquery.com/jquery-latest.min.js"></script> 

and socket emiting events 1 :

<script>  // create new websocket var socket = io.connect('http://localhost:8000/?profile_id=abcde2'); //..i want code here update  divs. </script> 

what need emit message on php file. many thanks!

if want serve html php, , have node.js socket server, socket server doesn't need serve html, can omit majority of example you're using. include script in .php serves html page , make sure url script targets socket server.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -