Cockatrice/webclient/src/websocket/events/SessionEvents/ServerIdentification.tsx
Jeremy Letto 8db9475804
Cleanup and refactor (#4361)
* fix three panel layout height issue

* rename websocket/services to websocket/persistence, implement LeaveRoom

* cleanup

* add new line eof

* move route components from /components to /containers

* remove duplicate style

Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
2021-05-18 23:06:41 -04:00

19 lines
657 B
TypeScript

import { StatusEnum } from "types";
export const ServerIdentification = {
id: ".Event_ServerIdentification.ext",
action: (info, webClient, _raw) => {
const { serverName, serverVersion, protocolVersion } = info;
if (protocolVersion !== webClient.protocolVersion) {
webClient.disconnect();
webClient.updateStatus(StatusEnum.DISCONNECTED, "Protocol version mismatch: " + protocolVersion);
return;
}
webClient.resetConnectionvars();
webClient.updateStatus(StatusEnum.LOGGINGIN, "Logging in...");
webClient.persistence.session.updateInfo(serverName, serverVersion);
webClient.commands.session.login();
}
};