Allow to create game room.

I would like to ask, how can I let players, to create game rooms.(Actually, not inside my web server, but inside their computer). For example, they connect to the website, create new room, but latency and other things depends on where host lives and etc. This is something like haxball.com or curvefever.com

One way I know is using a online database to store all the data needed to connect to a server.
For example, if someone creates a new server your program just adds automatically server ip, password, name, etc to an online database.
In the other game, just refresh the database with 1 button or every x seconds and users can now get server information.