code: def test_get_ws_url_when_cloud():
      """The websocket uses port 8080 when LIGHTNING_APP_STATE_URL is set."""
      assert _get_ws_url() == "ws://localhost:8080/api/v1/ws"
  
file_path: pytorch-lightning/tests/tests_app/frontend/panel/test_app_state_comm.py
imports: import os
  from unittest import mock
  from lightning.app.core.constants import APP_SERVER_PORT
  from lightning.app.frontend.panel.app_state_comm import _get_ws_url, _run_callbacks, _watch_app_state
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_ws_url_when_cloud() without return types