send reply_id to JS

This allows to execute JS PostMessage callbacks.

Also fix a memory leak in onDiscoveryStateChanged()
And clean up code removing trailing whitespaces and using std::endl

Change-Id: Icde67f58886d992cba89746fd663426ddcb6833c
Signed-off-by: Corentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>