private void appServer_SessionClose(CustomSession session, CloseReason reason) { if (session.Items.ContainsKey("deviceid")) { string deviceid = session.Items["deviceid"]?.ToString(); session.Logger.Warn($"客户端{deviceid}关闭:" + reason); } }
private void appServer_NewRecivede(CustomSession session, CustomRequestInfo requestInfo) { var bytes = requestInfo.Body; var key = requestInfo.Key; if (key == "deviceid") { var deviceid = byteToHexStr(bytes); session.Items["deviceid"] = deviceid; session.Logger.Debug($"客户端{deviceid}连接"); } else if (key == "cardid") { var card = getcardno(bytes); session.Logger.Debug($"卡号:{card}"); } }
private void appServer_NewConnected(CustomSession session) { }