Commit c1153f8d by Sixong.Zhu

status

parent 8f1e380a
Showing with 6 additions and 8 deletions
......@@ -6,6 +6,7 @@ import { ChatLoggerService } from "./logger";
import { Message, NotifyMessage } from "./models/chat";
import chat from "./index";
import { STATUS } from "xchat-client/dist/xchat";
wampDebug(true);
......@@ -72,7 +73,10 @@ export class Xim {
client.onstatuschange = (status: any, details: any) => {
this.onStatusChange(status, details);
if (status === "DISCONNECTED" || status === "CLOSED") {
if (
status === STATUS.DISCONNECTED ||
status === STATUS.CLOSED
) {
reject(status);
}
};
......@@ -332,16 +336,10 @@ export class Xim {
this.debug("xim connected");
}
/*
DISCONNECTED: "DISCONNECTED",
CONNECTING: "CONNECTING",
CONNECTED: "CONNECTED",
CLOSED: "CLOSED",
*/
private onStatusChange(status: any, details: any) {
this.debug("onstatuschange", status, details);
this.emit(Events.Status, status, details);
if (status === "DISCONNECTED" || status === "CLOSED") {
if (status === STATUS.DISCONNECTED || status === STATUS.CLOSED) {
this.hanldeOffline();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment