Tweak URL printout in terminal when launching the web viewer.

PiperOrigin-RevId: 958422471
Change-Id: I2d637c615015915eb01b65bb0bad22749886a372
This commit is contained in:
Saran Tunyasuvunakool
2026-08-03 09:40:24 -07:00
committed by Copybara-Service
parent d33f297b56
commit b0c3486249
4 changed files with 26 additions and 48 deletions
@@ -187,7 +187,8 @@ limitations under the License.
// The session id tells the server which page is dropping; it only
// accepts drops from the controller.
const sid = (window.Module && Module.sessionId) || "";
const ws = new WebSocket(proto + location.host + "/drop?sid=" + encodeURIComponent(sid));
const dropUrl = proto + location.host + "/drop?sid=" + encodeURIComponent(sid);
const ws = new WebSocket(dropUrl);
ws.binaryType = "arraybuffer";
ws.onopen = () => {
for (const frame of frames) ws.send(frame);
@@ -72,6 +72,7 @@ void RemoteUi::Connect(const std::string& url) {
Network::Disconnect(socket_);
socket_ = nullptr;
}
// The port argument is unused when a full URL is passed.
LOG(Info, "Connecting to WebSocket at %s", url.c_str());
socket_ = Network::Connect(url.c_str(), 0);
@@ -122,6 +122,7 @@ void Session::CloseSocket() {
void Session::Connect(const std::string& url) {
// Drop any lingering socket first so a reconnect cannot leak the old one.
CloseSocket();
EmscriptenWebSocketCreateAttributes attr;
emscripten_websocket_init_create_attributes(&attr);
attr.url = url.c_str();