System - server reconnecting !

This commit is contained in:
Heath Volmer
2018-03-07 14:09:37 -07:00
parent 359bd508e5
commit cdbab152f6
3 changed files with 8 additions and 6 deletions

View File

@@ -434,12 +434,13 @@ namespace PepperDash.Essentials
if (WSClient == null) if (WSClient == null)
{ {
WSClient = new WebSocketClient(); WSClient = new WebSocketClient();
}
WSClient.URL = string.Format("wss://{0}/system/join/{1}", Config.ServerUrl, this.SystemUuid); WSClient.URL = string.Format("wss://{0}/system/join/{1}", Config.ServerUrl, this.SystemUuid);
WSClient.Connect(); WSClient.Connect();
Debug.Console(0, this, "Websocket connected"); Debug.Console(0, this, "Websocket connected");
WSClient.ReceiveCallBack = WebsocketReceive; WSClient.ReceiveCallBack = WebsocketReceive;
WSClient.ReceiveAsync(); WSClient.ReceiveAsync();
}
//// ********************************** //// **********************************
@@ -497,6 +498,7 @@ namespace PepperDash.Essentials
WebSocketClient.WEBSOCKET_RESULT_CODES err) WebSocketClient.WEBSOCKET_RESULT_CODES err)
{ {
var rx = System.Text.Encoding.UTF8.GetString(data, 0, (int)length); var rx = System.Text.Encoding.UTF8.GetString(data, 0, (int)length);
if(rx.Length > 0)
ParseStreamRx(rx); ParseStreamRx(rx);
WSClient.ReceiveAsync(); WSClient.ReceiveAsync();
return 1; return 1;