Added WebSocketInternal.
Changed some disconnect code in gateway.