Using a defined response structure for the connect response will be cleaner and less error-prone.
I think we have to do this as a response message because I have been unable to find any way to pass this back in headers or response data on the initial connect flow.
And this stackoverflow post suggests that websockets simply doesn't support this.