collab_client: Set CONNECTED after sending CLIENT_READY

This makes it possible to defer actions until after the CLIENT_READY
message is sent to the server.
rhansen-collab_client
Richard Hansen 2021-03-30 18:18:02 -04:00
parent 05f6e196ae
commit 1ff228391d
1 changed files with 4 additions and 4 deletions

View File

@ -215,6 +215,10 @@ const sendClientReady = (isReconnect, messageType) => {
}
socket.json.send(msg);
// If this is a reconnect then the server won't send another CLIENT_VARS because we are already
// configured and ready to send arbitrary messages to the server.
if (isReconnect) pad.collabClient.setChannelState('CONNECTED');
};
const handshake = () => {
@ -237,10 +241,6 @@ const handshake = () => {
});
socket.on('reconnect', () => {
// pad.collabClient might be null if the hanshake failed (or it never got that far).
if (pad.collabClient != null) {
pad.collabClient.setChannelState('CONNECTED');
}
sendClientReady(receivedClientVars);
});