Added a keep alive to be sent before connected fires for websockets

#2637
Fixed code analysis errors

#2637