workadventure/back/src/Services/MessageHelpers.ts

16 lines
521 B
TypeScript
Raw Normal View History

2020-12-04 15:58:31 +01:00
import {ErrorMessage, ServerToClientMessage} from "../Messages/generated/messages_pb";
import {UserSocket} from "_Model/User";
export function emitError(Client: UserSocket, message: string): void {
const errorMessage = new ErrorMessage();
errorMessage.setMessage(message);
const serverToClientMessage = new ServerToClientMessage();
serverToClientMessage.setErrormessage(errorMessage);
//if (!Client.disconnecting) {
Client.write(serverToClientMessage);
//}
console.warn(message);
}