You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a game and need to create server-side bots. Ideally I'd do this by 'faking' a real client connection, or a real one from server-side. It has to behave like a real player's socket.
Stack Overflow suggests it is this easy to do in node.js:
var clientIo = require('socket.io-client');
var socket = clientIo.connect("http://" + node.ip + ":" + node.port);
//Then use it like normal socket to add a new player to the game.
However, I just can't figure out how to translate this into what we'd do in php.
The closest I can get to looks something like this:
$clientIo = new \PHPSocketIO\Client($server,$conn);
$socket = $clientIo->connect(???);
But despite my research I can't figure out what it wants from $server and $conn (I've tired the obvious) or the other attributes I need to give to it. Or if I'm barking up the wrong tree entirely. I thought I'd ask about this here as Stack Overflow is often not helpful with phpsocket.io.
Help would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
The data format transmitted by the client and the server is similar to this. You can see it in network in Google browser. You can learn more about the data format through observation.
This is the js client side code for the data format above.
Hi everyone!
I'm working on a game and need to create server-side bots. Ideally I'd do this by 'faking' a real client connection, or a real one from server-side. It has to behave like a real player's socket.
Stack Overflow suggests it is this easy to do in node.js:
However, I just can't figure out how to translate this into what we'd do in php.
The closest I can get to looks something like this:
But despite my research I can't figure out what it wants from $server and $conn (I've tired the obvious) or the other attributes I need to give to it. Or if I'm barking up the wrong tree entirely. I thought I'd ask about this here as Stack Overflow is often not helpful with phpsocket.io.
Help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: