Client initiates a websocket connection, the connection is now in a kind of empty state. Then the client send command to Setup a bridge on the server, configures the target the bridge connects to, and the server sends back a brgID identifies the bridge.
The client may create multiple websocket connections and let them join the bridge by sending Join command and specify the brgID got from Setup command.
For each Data message sent from client, pass it to the bridge. If the websocket connection is still in empty state, then it's an error, and should be force closed.
For each Data message received from bridge, select a websocket connection and send the data to it.
Session
It's a server client architecture.
Client initiates a websocket connection, the connection is now in a kind of empty state. Then the client send command to Setup a bridge on the server, configures the target the bridge connects to, and the server sends back a brgID identifies the bridge.
The client may create multiple websocket connections and let them join the bridge by sending Join command and specify the brgID got from Setup command.
For each Data message sent from client, pass it to the bridge. If the websocket connection is still in empty state, then it's an error, and should be force closed.
For each Data message received from bridge, select a websocket connection and send the data to it.
For the close part, leave for future.
Message Frames: