/// <summary> /// 发送事件到客户端 /// </summary> /// <param name="httpEvent">http事件</param> /// <exception cref="ArgumentNullException"></exception> /// <returns></returns> public bool SendEvent(HttpEvent httpEvent) { if (httpEvent == null) { throw new ArgumentNullException(); } try { var bytes = Encoding.UTF8.GetBytes(httpEvent.ToString()); this.session.Send(bytes); return(true); } catch (Exception) { return(false); } }
/// <summary> /// 发送事件到客户端 /// </summary> /// <param name="httpEvent">http事件</param> /// <exception cref="ArgumentNullException"></exception> /// <returns></returns> public bool SendEvent(HttpEvent httpEvent) { if (httpEvent == null) { throw new ArgumentNullException(); } try { var bytes = Encoding.UTF8.GetBytes(httpEvent.ToString()); this.session.Send(new ByteRange(bytes)); return true; } catch (Exception) { return false; } }