Skip to content

WebSocketServer.Payload.AuthMessage

Alex Ander edited this page Apr 14, 2018 · 1 revision
interface AuthMessage {
    Message?: string;
    Status?: AuthStatusCode;
    UserName: string;
}
enum AuthStatusCode { ERROR, SUCCESS }
// client -> server
ws.send(JSON.stringify({
	Type: "AUTH_MESSAGE",
	Payload: {
		Token: "0d788151ccfb3c0"
	}
}));
// [success] server -> client
{
	Type: "AUTH_MESSAGE",
	Payload: {
		Message: "SUCCESS",
		UsersList: ["loktionov129", "Scorpio92"]
	}
}
// [error] server -> client
{
	Type: "AUTH_MESSAGE",
	Payload: {
		Message: "ERROR.ALREADY_CONNECTED"
	}
}
// [error] server -> client
{
	Type: "AUTH_MESSAGE",
	Payload: {
		Message: "ERROR.NOT_FOUND"
	}
}

Clone this wiki locally