private void WebsocketserverMain_OnDataIn(object sender, WebsocketserverDataInEventArgs ex) { try { try { log.Info("Received Data From :" + ex.ConnectionId + ";Data: " + ex.Text); var dataObj = JObject.Parse(ex.Text); string inspexIQConnectionId = (string)dataObj["inspexIQConnectionId"]; //need to query server for the PI IPaddress if (string.IsNullOrEmpty(inspexIQConnectionId)) { string serviceType = (string)dataObj["serviceType"]; string sellingMethod = (string)dataObj["sellingMethod"]; string vinCode = (string)dataObj["vinCode"]; string vehicleId = (string)dataObj["vehicleId"]; string autoInspexID = (string)dataObj["autoInspexID"]; string uuid = (string)dataObj["uuid"]; string imageType = (string)dataObj["imageType"]; string sequenceNo = (string)dataObj["sequenceNo"]; var message = new { serviceType = serviceType, sellingMethod = sellingMethod, vinCode = vinCode, vehicleId = vehicleId, autoInspexID = autoInspexID, uuid = uuid, imageType = imageType, sequenceNo = sequenceNo, inspexIQConnectionId = ex.ConnectionId, }; var json = JsonConvert.SerializeObject(message); foreach (var c in WebsocketserverMain.Connections.Values) { WebsocketserverMain.SendText(c.ConnectionId, json); } } else { WebsocketserverMain.SendText(inspexIQConnectionId, ex.Text); } } catch (Exception e) { } } catch (Exception ext) { log.Error(ext.Message, ext); } }
private async void WebsocketserverMain_OnDataIn(object sender, WebsocketserverDataInEventArgs ex) { try { log.Info(ex.Text); var dataObj = JObject.Parse(ex.Text); var installerName = (string)dataObj["InstallerName"] + ""; var installDate = (string)dataObj["InstallerName"] + ""; if (installerName != "" && installDate != "") { await InstallnewPI(dataObj); } else { await saveData(dataObj); } } catch (Exception ext) { log.Error(ext.Message, ext); } }