SocketIO + PhantomJS not working
I have a rather specific problem, but I hope people can point me in the right direction on how to debug or even fix it. I am trying to write a local client that can run and test a web page I have created that uses SocketIO.
I run Phantom with the --web-security = false command line parameter, as otherwise the inputs or outputs are not legal, since my local tester is not considered part of the same origin as my website that I am testing ( fix this before listening works).
Using PhantomJS I cannot get the emit function from SocketIO to work. It just fails without any error. I know the socket is actually connected because it can listen for incoming events normally (this is how the on () method works). I can run the same code in a web browser and it works fine.
Does anyone know of alternatives to emit () that a lower level emit () fires, maybe I could pay, or how should I check things further? Any help is appreciated.
source to share
After a lot of research, it looks like this form of sockets is simply not supported in phantomjs. When new versions are 2.0 they should be, but until then other options are better. I have tried looking for a gasket for a while but with no success.
In the end, I used node.js instead of node.js, made socket connections and then used the phantomjs node module to interact with the browser, not using a script as a pure phantom script. This meant the api interaction logic was pushed to the node application and the phantom code was to interact with the page, but I was able to achieve the goal of testing this way, so I consider it successful.
source to share