I am not sure why you want to use the RTM + WebSocket on the server and not our web channel but the process of communication using web-socket is explained at a high level remains the same, regardless of whether you use the websdk or implement a custom solution.
For using RTM and WebSocket, the mentioned URL gives you basic steps.
Step 1: First the authentication JWT is required. This will return an access token (JWT) using the client id, secret, anonymous and userIdentity.
Step2: Then /jwtgrant call will validate the JWT.
Step3: /rtm/start call will return the websocket URL. This URL has to be used to establish a connection.
There are few more things which our web-sdk does - like sending and receiving messages from WebSocket. You may study the same on our open-source sdk.
Example - https://github.com/Koredotcom/web-kore-sdk/blob/master/UI/chatWindow.js#L1888
You may also need to check how the websdk maintains webSocketConnection. example - https://github.com/Koredotcom/web-kore-sdk/blob/master/kore-bot-sdk-client.js#L1235
Since this is a custom requirement, if you have any SoW with our professional services team you will be better off.
Did you consider using our webhook channel for bot communication instead of creating a custom WebSocket solution?