void Ping() { var requestPayload = new SocketRequestPayload { op = SocketGatewayUtils.OPCODE_PING, d = new SocketPingRequest { ts = SocketGatewayUtils.DateTimeToUnixTimestamp(DateTime.Now) } }; this._Send(requestPayload); }
void _Send(SocketRequestPayload requestPayload) { var payload = JsonConvert.SerializeObject(requestPayload); if (this.connected) { this.m_Socket?.Send(payload); } else { this.m_PayloadQueue.Add(payload); } }
public void Identify(string sessionId, string commitId) { //cache the current m_SessionId for resume this.m_SessionId = sessionId; var requestPayload = new SocketRequestPayload { op = SocketGatewayUtils.OPCODE_IDENTIFY, d = new SocketIdentifyRequest { ls = this.m_SessionId, commitId = commitId, clientType = "connect", isApp = true, properties = new Dictionary <string, string>() } }; this._Send(requestPayload); }
bool _Resume() { if (!this.resumable) { return(false); } var requestPayload = new SocketRequestPayload { op = SocketGatewayUtils.OPCODE_RESUME, d = new SocketResumeRequest { sessionId = this.m_SessionId, seq = this.m_Sequence } }; this._Send(requestPayload); return(true); }