perf(ui): only build WS payload if connection is opened