How to realize that when websocket connects to the server, it can be pushed to the browser by websocket at the same time

as shown in the figure:
I am now Server B, how to connect Server A with websocket and forward it to browser C with websocket.
the reason for this requirement is that the browser cannot know the address of Server A.

clipboard.png

Jul.02,2022

uses rpc technology


ServerB to open a service port. ServerA and BrowserC are used as client connection B. in B, the websocket objects of An and C are stored with map for sending messages. Then, A sends a message to B, gets the message in the onMessage () method, get C's websocket client object in map, calls the send () method, and forwards it to C.

Menu