1

Here is my setup:

  1. Windows 8.1 with Ubuntu 18.04 within VirtuablBox 6.0
  2. Run a websocket server at 127.0.0.1:8083 within VirtuablBox
  3. Within the VirtuablBox, I can connect to the websocket server with websocat ws://127.0.0.1:8083

What is the setup I should use in order for me to connect to the websocket server through the Chrome extension(i.e Smart Websocket Client) running on Windows host machine.

I have tried to connect to '127.0.01:8083' within Smart Websocket Client, but the error is shown:

Failed to construct 'WebSocket': The URL '127.0.01:8083' is invalid.

Thank you

vidarlo
  • 3,775
  • 1
  • 12
  • 25
q0987
  • 81
  • 5
  • Have you tried connecting from Windows to the IP-Adress of "VirtualBox" instead of the Windows localhost? – bjoster Feb 22 '22 at 16:58
  • The network of the virtualbox has Port Forwarding to 5678(Host Port) 127.0.0.1(Host IP) for SSH and I can connect putty running on windows to the virtualbox without problems. However, I didn't find a way that I could connect the websocket Chrome extension running on Windows to the virtualbox. – q0987 Feb 22 '22 at 21:52
  • Can someone tell me why I get vote-down on this question? What is the problem of this question posted here? – q0987 Feb 24 '22 at 16:56

1 Answers1

1

Configure a port forward in Virtualbox. Web sockets is a regular TCP stream, and there's no reason it should not work.

As noted you have port forwarding configured for SSH, so simply add another one for the websocket port.

vidarlo
  • 3,775
  • 1
  • 12
  • 25
  • I added the following into the Port Forwarding Rules "Websocket, TCP, 127.0.0.1, 8083, 10.0.2.15, 23 for Name, Protocol, Host IP, Host Port, Guest IP, Guest Port", Then I used Smart Websocket Client on windows to connect to ws://127.0.0.1:8083. But it still doesn't work. – q0987 Feb 23 '22 at 19:10
  • Is port 23 the correct guest port? – vidarlo Feb 23 '22 at 20:45
  • How do I know whether the port 23 is correct? I just randomly selected one. – q0987 Feb 23 '22 at 22:04
  • You can't ***randomly*** select a port and expect it to be the correct one! You have to know what port your service listens on, and use that port! You have to know your own configuration to manage to make complex systems work. SSH uses port 22, by default, but your websocket probably does not use port 23. You mention 8083 in your question, where did you get this from? – vidarlo Feb 23 '22 at 22:27