Commit c1153f8d by Sixong.Zhu

status

parent 8f1e380a
Showing with 6 additions and 8 deletions
...@@ -6,6 +6,7 @@ import { ChatLoggerService } from "./logger"; ...@@ -6,6 +6,7 @@ import { ChatLoggerService } from "./logger";
import { Message, NotifyMessage } from "./models/chat"; import { Message, NotifyMessage } from "./models/chat";
import chat from "./index"; import chat from "./index";
import { STATUS } from "xchat-client/dist/xchat";
wampDebug(true); wampDebug(true);
...@@ -72,7 +73,10 @@ export class Xim { ...@@ -72,7 +73,10 @@ export class Xim {
client.onstatuschange = (status: any, details: any) => { client.onstatuschange = (status: any, details: any) => {
this.onStatusChange(status, details); this.onStatusChange(status, details);
if (status === "DISCONNECTED" || status === "CLOSED") { if (
status === STATUS.DISCONNECTED ||
status === STATUS.CLOSED
) {
reject(status); reject(status);
} }
}; };
...@@ -332,16 +336,10 @@ export class Xim { ...@@ -332,16 +336,10 @@ export class Xim {
this.debug("xim connected"); this.debug("xim connected");
} }
/*
DISCONNECTED: "DISCONNECTED",
CONNECTING: "CONNECTING",
CONNECTED: "CONNECTED",
CLOSED: "CLOSED",
*/
private onStatusChange(status: any, details: any) { private onStatusChange(status: any, details: any) {
this.debug("onstatuschange", status, details); this.debug("onstatuschange", status, details);
this.emit(Events.Status, status, details); this.emit(Events.Status, status, details);
if (status === "DISCONNECTED" || status === "CLOSED") { if (status === STATUS.DISCONNECTED || status === STATUS.CLOSED) {
this.hanldeOffline(); 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