Phoenix Sockets with PhantomJS

Hi all,
did any of you use phantomjs to test the application which uses websockets? I am having troubles with it: after connect, phantomjs shows the following output:

[ERROR - 2017-04-06T09:28:52.221Z] Session [71fc2810-1aab-11e7-a447-f3ccc051cf03] - page.onError - msg: TypeError: JSON.stringify cannot serialize cyclic structures.

  :262 in error
[ERROR - 2017-04-06T09:28:52.222Z] Session [71fc2810-1aab-11e7-a447-f3ccc051cf03] - page.onError - stack:
  stringify (http://localhost:4001/js/app.js:13659)
  callback (http://localhost:4001/js/app.js:13659)
  push (http://localhost:4001/js/app.js:13663)
  send (http://localhost:4001/js/app.js:13068)
  push (http://localhost:4001/js/app.js:13265)
  (anonymous function) (http://localhost:4001/tests/core:177)
  (anonymous function) (http://localhost:4001/js/app.js:13372)
  map (:0)
  trigger (http://localhost:4001/js/app.js:13371)
  (anonymous function) (http://localhost:4001/js/app.js:13714)
  forEach (:0)
  onConnMessage (http://localhost:4001/js/app.js:13713)
  onmessage (http://localhost:4001/js/app.js:13526)

Notice that everything works fine with the chromedriver. I’ve tried phantomjs version 2.0.0 and 2.1.1. Phoenix 1.2, Elixir version 1.3.

I did a small research, and it crashes here: https://github.com/phoenixframework/phoenix/blob/master/priv/static/phoenix.js#L732

  this.conn.onmessage = function (event) {
    return _this5.onConnMessage(event);
  };
...
  var callback = function callback() {
    return _this7.conn.send(JSON.stringify(data));
  };

I just found that this part of javascript has been change in Phoenix 1.3. Will try to upgrade to rc-1

EDIT: the same issue with Phoenix 1.3, JSON.stringify is just moved to the different part of code.

Do you think it is an error of phantomjs? No other browser I’ve checked complains about it…