private void Handshake(string SID, EngineIOTransport Transport) { if (Option.SetCookie) { Transport.On(EngineIOTransport.Event.HEADERS, (Headers) => { List <string> Cookies = new List <string>(); foreach (string Key in Option.Cookies.Keys) { string Cookie = Key; string Value = Option.Cookies[Key]; if (!string.IsNullOrWhiteSpace(Value)) { Cookie += ('=' + Value); } Cookies.Add(Cookie); } (Headers as NameValueCollection)["Set-Cookie"] = string.Join("; ", Cookies); }); } EngineIOSocket Socket = new EngineIOSocket(SID, this, Transport); _Clients.TryAdd(SID, Socket.Once(EngineIOSocket.Event.CLOSE, () => _Clients.TryRemove(SID, out _))); Emit(Event.CONNECTION, Socket); }