Fix for race condition in the debug server

Fixed a possible race condition by adding the port as a query parameter
for the websocket connection. If port number is not provided the
connection falls back to the last provided port number just as before.