update
This commit is contained in:
@ -45,8 +45,17 @@ export class WebSocketPayload {
|
||||
return null;
|
||||
}
|
||||
|
||||
let wsEvent = WebSocketEvent[<keyof typeof WebSocketEvent> rawPayload.event];
|
||||
let wsEvent = WebSocketEvent[<keyof typeof WebSocketEvent>rawPayload.event];
|
||||
|
||||
return new WebSocketPayload(wsEvent, rawPayload.status, rawPayload.data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the payload as base64 encoded json string
|
||||
*/
|
||||
public toString(): string {
|
||||
let json = JSON.stringify({"event": this._event, status: this._status, data: this._data});
|
||||
json = (window) ? btoa(json) : Buffer.from(json).toString("base64");
|
||||
return json;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user