mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 12:06:58 +00:00
Attached Parse method to websocket receive
This commit is contained in:
parent
62e5e6f176
commit
359bd508e5
3 changed files with 3 additions and 16 deletions
|
|
@ -486,7 +486,6 @@ namespace PepperDash.Essentials
|
|||
ResetOrStartHearbeatTimer();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
@ -498,8 +497,7 @@ namespace PepperDash.Essentials
|
|||
WebSocketClient.WEBSOCKET_RESULT_CODES err)
|
||||
{
|
||||
var rx = System.Text.Encoding.UTF8.GetString(data, 0, (int)length);
|
||||
|
||||
Debug.Console(0, this, "WS RECEIVED {0}", rx);
|
||||
ParseStreamRx(rx);
|
||||
WSClient.ReceiveAsync();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -509,16 +507,9 @@ namespace PepperDash.Essentials
|
|||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void SSEClient_LineReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
||||
void ParseStreamRx(string message)
|
||||
{
|
||||
if(e.Text.IndexOf("data:") > -1)
|
||||
{
|
||||
SseMessageLengthBeforeFailureCount += e.Text.Length;
|
||||
|
||||
var message = e.Text.Substring(6);
|
||||
|
||||
Debug.Console(1, this, "Message RX: '{0}'", message);
|
||||
|
||||
try
|
||||
{
|
||||
var messageObj = JObject.Parse(message);
|
||||
|
|
@ -536,13 +527,10 @@ namespace PepperDash.Essentials
|
|||
else if (type == "close")
|
||||
{
|
||||
WSClient.Disconnect();
|
||||
//SseClient.Disconnect();
|
||||
|
||||
ServerHeartbeatCheckTimer.Stop();
|
||||
// Start the reconnect timer
|
||||
StartReconnectTimer();
|
||||
//ServerReconnectTimer = new CTimer(ConnectSseClient, null, ServerReconnectInterval, ServerReconnectInterval);
|
||||
//ServerReconnectTimer.Reset(ServerReconnectInterval, ServerReconnectInterval);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -636,5 +624,4 @@ namespace PepperDash.Essentials
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue