This is not good. There could be more than one `request` with the same name. You should generate and assign unique id to each of the requests.

So, create some simple counter variable and with each request, increase it by one.

Request as such should have following properties: `name`, `args`, the later should be a map of arguments that the server is expecting for the request with the given name.

So, this lines should look like: `request_map[getUniqueId()] = map['request']().toJSON();`
You should implement `toJSON` method and `fromJSON` constructor.