I wanted to play agar.io with my friend. He gave me his server IP and I tried to connect with it through the Web Console:

connect("ws://" + prompt("Server IP", "XXX.XXX.XXX.XXX:XXXX")); void 0;

But after prompting this script, console says

"Connecting to ws://"
socket open
TypeError: b is undefined

What's wrong with this script? Are there any ways to play together?


Looks like the developer has "disabled" this "feature".

The Agario developer has disabled the function to directly connect to a server.

If you have any feedback about the removal of this function, please leave them here in this post. It won't help anything to message the moderators or to PM the developer.

EDIT: There have been some at userscripts that tried to bypass this, they failed or were already patched. Furthermore, these are server exploits, so as by the rules, scripts like this will be removed and might result in a ban up to 3 days. Asking for scripts like this is also not allowed.



I checked the agar source code a few days ago and noticed that the code has been changed. The trick you were using doesn't work any more. Now it's much more difficult to connect to the same playground.

  • 5
    Saying it's "much more difficult" implies it's possible. If you know, could you describe how? – DBS Jun 28 '15 at 1:01
  • I think there's a script that reloads the page until you get a given IP. – user109232 Jul 2 '15 at 22:41
  • It is possible but it's quite hard to achieve. Now you are assigned a server by random and you have to have a ticket to connect. You can write a script to poll agar.io/findServer until you get the ticket to target IP. Note there are few servers running on the same IP:PORT so you will have to check the top list manually to make sure you are connected to the same one. – Piotr Dabkowski Sep 7 '15 at 12:24

There are currently 2 ways of doing this.

Method 1 (Running console command)

I am not 100% sure if this works as I do not know anu agar.io servers to connect to but if you enter the command connect in chrome's console (accessible by going to The options menu -> More tools -> Javascript Console)

Then enter: connect("ws://youriphere:yourporthere");

Method 2 (Installing script)


NOTE: This method allows you to see the IP of the server you are connected to so you can share it with your friends! Yay!

  1. Install a 'Userscript' plugin for your browser. (Chrome: Tampermonkey, Firefox: Greasemonkey)

  2. Intstall the userscript, and click 'Install'. Accept any warnings.

  3. Go to agar.io. If the page is already open, refresh.

  4. Select a region. (Make sure your friends select the same region.)

  5. Go to m.agar.io

  6. Copy ip on first line, with port.

  7. Go back to game

  8. Enter IP, hit 'Connect'.

  9. Profit!

Not the answer you're looking for? Browse other questions tagged or ask your own question.