node.js - PHP sending message to Node / Socket.IO server -


I'm not sure I'm going right about this. I want to paste my socket .IO server and do not want to create a separate HTTP server inside the node. With it, can I create a PHP client that can send data (eg: player buys items from online shop) node socket. Directly on ISO server?

I started with it:

  & lt ;? Php class communicator {connect public function ($ address, $ port) {$ socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP); If {$ socket} {try {socket_connect ($ socket, $ address, $ port); } Hold (exception $ e) {throwing new exception ($ e-> getMessage ()); }} And {throw the new exception ('could not make socket'.); }}? & Gt;   

The socket just connects properly to the node server, but how do I start getting data directly from the PHP client?

Example: Say how do I get to send a message to the server socket_write socket. How do I get through iO?

Hope that my question comes into being!

using implements for im php and socket.io, I have completed sending data There are problems with connections to occur, 3 or 4 seconds.

  & lt ;? Php requirement (__DIR__. '/ Elephantio / Client.fp'); Use ElephantIO \ Client as ElephantIOClient; $ Elephant = new Elephant ioculient ('http: // localhost: 8080', 'socket.o', 1, false, true, true); $ Elephant- & gt; Init (); $ Elephant- & gt; Eject ('message', 'foo'); $ Elephant- & gt; near ();    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -