• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

WebSocket access via port forwarding?

Q&A Forum › WebSocket access via port forwarding?
0 Vote Up Vote Down
Steen Spaten asked 10 months ago

If my question is off topic then please dismiss me – or if you know where to find the answer please inform me.

In your book “Build Web Servers” 2nd edition you mention the handshake. “The handshake starts with an HTTP
request/response, allowing servers to handle HTTP connections and WebSocket
connections on the same port.”  My question is somewhat related – but is not directly explained to my context – sorry for that. I am aware of your project which includes a SIM-card but that is not suitable for me.

My ESP webserver is running when I am on WiFi. I can press buttons and they respond as they should via Websocket communication. However I would like to reach the webserver from outside via port forwarding. I can open the page from outside, but I cannot execute any command via the websocket. I don’t know how to handle this. When I am home and with WiFi connected  I can open the webserver and execute commands via a Chrome plugin called “Simple Websocket Client”. They respond as they should. But when I am accessing from outside I cannot open the webserver.

WiFiClient BellmaticUARTClient;     // manage connections to BellUploadserver, allowing UART <-> TCP
WiFiServer bellmaticTcpServer(bellPort);      // listens for incoming TCP connections on (default) port 8240
AsyncWebServer ESP32Server(80);             // HTTP port – Communication to phone HTTP pages, buttons etc.
AsyncWebSocket buttonSocket(“/index”);   // This is one of my Websockets
AsyncWebSocket updateSocket(“/wsBtnUpd”);  // This is the other Websocket
AsyncWebSocketClient *phoneClient = nullptr;
AsyncWebSocketClient *bellClient = nullptr;
The WiFiClient and WiFiServer is taking care of the UART to TCP conversion.
Hope someone can help…
1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 10 months ago

Hi.
I’m sorry, but we don’t have any tutorials about WebSocket via port forwarding and I’m not familiar with that specific subject.
I’m sorry that I can’t help much.
Regards,
Sara
 

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 Version 1.7 November 28, 2025
  • [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 V1.6 September 9, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.