Added init message to websockets

#2637
Made changes as per code review feedback

#2637
Fixed some code analysis errors

#2637