void Start() { packetbuffer = new StringBuilder(); InitBT(); this.gameObject.GetComponent <PingPongObj>().initOBJ(); ppManager = this.gameObject.GetComponent <PingPongManager>(); objectCarDevice = GameObject.Find("CarStatusObject"); statusDeserializer = objectCarDevice.GetComponent <ObjectCarDevice>().Basecardivice.statusparser; statusDeserializer.OnParsed += StatusDeserializer_OnParsed; statusDeserializer.OnParsedError += StatusDeserializer_OnParsedError; carDivice = objectCarDevice.GetComponent <ObjectCarDevice>().Basecardivice; }
internal WebSocketImplementation(Guid guid, Func <MemoryStream> recycledStreamFactory, Stream stream, TimeSpan keepAliveInterval, string secWebSocketExtensions, bool includeExceptionInCloseResponse, bool isClient, string subProtocol) { _guid = guid; _recycledStreamFactory = recycledStreamFactory; _stream = stream; _isClient = isClient; _subProtocol = subProtocol; _internalReadCts = new CancellationTokenSource(); _state = WebSocketState.Open; if (secWebSocketExtensions?.IndexOf("permessage-deflate") >= 0) { _usePerMessageDeflate = true; Events.Log.UsePerMessageDeflate(guid); } else { Events.Log.NoMessageCompression(guid); } KeepAliveInterval = keepAliveInterval; _includeExceptionInCloseResponse = includeExceptionInCloseResponse; if (keepAliveInterval.Ticks < 0) { throw new InvalidOperationException("KeepAliveInterval must be Zero or positive"); } if (keepAliveInterval == TimeSpan.Zero) { Events.Log.KeepAliveIntervalZero(guid); } else { // the ping pong manager starts a task // but we don't have to keep a reference to it #pragma warning disable 0219 PingPongManager pingPongManager = new PingPongManager(guid, this, keepAliveInterval, _internalReadCts.Token); #pragma warning restore 0219 } }