private void CreateSession(string id, HttpContext context) { var ea = new SessionCreatingEventArgs(id, context); OnSessionCreating?.Invoke(this, ea); if (ea.Cancel) { return; } context.Response.Headers.Add("Content-Type", "text/event-stream"); context.Response.WriteAsync("data: connected\n\n"); context.Response.Body.Flush(); _sessions.AddOrUpdate(id, context, (key, oldContext) => { oldContext.Abort(); return(context); }); OnSessionCreated?.Invoke(this, new SessionCreatedEventArgs(id, context)); }
internal void FireSessionCreated(IAudioSessionControl newSession) { OnSessionCreated?.Invoke(this, newSession); }
private void ProcessEvent() { if (isEvent) { switch (eventTypeString) { case "LoginStateChangeEvent": OnLoginStateChange?.Invoke(cookie, accountHandle, statusCode, statusString, state); break; case "SessionNewEvent": OnNewSession?.Invoke(cookie, accountHandle, eventSessionHandle, state, nameString, uriString); break; case "SessionStateChangeEvent": OnSessionStateChange?.Invoke(cookie, uriString, statusCode, statusString, eventSessionHandle, state, isChannel, nameString); break; case "ParticipantStateChangeEvent": OnParticipantStateChange?.Invoke(cookie, uriString, statusCode, statusString, state, nameString, displayNameString, participantType); break; case "ParticipantPropertiesEvent": OnParticipantProperties?.Invoke(cookie, uriString, statusCode, statusString, isLocallyMuted, isModeratorMuted, isSpeaking, volume, energy); break; case "AuxAudioPropertiesEvent": OnAuxAudioProperties?.Invoke(cookie, energy); break; } } else { switch (actionString) { case "Connector.Create.1": OnConnectorCreated?.Invoke(cookie, statusCode, statusString, connectorHandle); break; case "Account.Login.1": OnLogin?.Invoke(cookie, statusCode, statusString, accountHandle); break; case "Session.Create.1": OnSessionCreated?.Invoke(cookie, statusCode, statusString, sessionHandle); break; case "Session.Connect.1": OnSessionConnected?.Invoke(cookie, statusCode, statusString); break; case "Session.Terminate.1": OnSessionTerminated?.Invoke(cookie, statusCode, statusString); break; case "Account.Logout.1": OnAccountLogout?.Invoke(cookie, statusCode, statusString); break; case "Connector.InitiateShutdown.1": OnConnectorInitiateShutdown?.Invoke(cookie, statusCode, statusString); break; case "Account.ChannelGetList.1": OnAccountChannelGetList?.Invoke(cookie, statusCode, statusString); break; case "Aux.GetCaptureDevices.1": OnCaptureDevices?.Invoke(cookie, statusCode, statusString, nameString); break; case "Aux.GetRenderDevices.1": OnRenderDevices?.Invoke(cookie, statusCode, statusString, nameString); break; } } }