Creates an internal unsubscribe message. The system creates this message when the
WebSocket session ends and sends it to the subscribed message handlers for cleaning
up

@param sessionId the WebSocket session id
178732
public static UnsubscribeMessage createCleanupMessage(WebSocketSession session) {
		UnsubscribeMessage msg = new UnsubscribeMessage("**");

		msg.setWebSocketSessionId(session.getId());
		msg.setPrincipal(session.getPrincipal());
		msg.setWampSession(new WampSession(session));

		msg.cleanup = true;

		return msg;
	}
852995
public void deleteSubscription(
    String subId,
    boolean force) 
    
    throws SINotAuthorizedException, 
           SIDurableSubscriptionNotFoundException, 
           SIDestinationLockedException, 
           SIResourceException, 
           SIIncorrectCallException,
           SINotPossibleInCurrentConfigurationException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "deleteSubscription",
        new Object[] { subId, new Boolean(force) });

    checkStarted();
    
    if (subId == null)
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "deleteSubscription", "SubId is null");
      throw new SIDurableSubscriptionNotFoundException(
        nls.getFormattedMessage(
          "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072",
          new Object[] {null,
                        messageProcessor.getMessagingEngineName()},
          null));
    }

    HashMap durableSubs = destinationManager.getDurableSubscriptionsTable();    

    synchronized (durableSubs)
    {
      // Look up the consumer dispatcher for this subId in the system durable subs list
      ConsumerDispatcher cd = (ConsumerDispatcher) durableSubs.get(subId);
      
      // Does the subscription exist, if it doesn't, throw a 
      // SIDestinationNotFoundException
      if (cd == null)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
          SibTr.exit(tc, "deleteSubscription", "SIDurableSubscriptionNotFoundException");
          
        throw new SIDurableSubscriptionNotFoundException(          
          nls.getFormattedMessage(
            "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0146",
            new Object[] { subId,
                           messageProcessor.getMessagingEngineName() },
          null));
      }        

      // Obtain the destination from the queueing points
      DestinationHandler destination = cd.getDestination();

      // Call the deleteDurableSubscription method on the destination
      // NOTE: this assumes the durable subscription is always local
      destination.deleteDurableSubscription(subId, messageProcessor.getMessagingEngineName());
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "deleteSubscription");
  }
810476
def unsubscribe(self, callback_id):
        
        request = self.get_active_subscription(callback_id)
        request['mode'] = 'unsubscribe'
        self.subscribe_impl(callback_id, **request)
252517
public void unsubscribe(String channel) {
		ChannelSubscription subscribedChannel = subscribedChannels.get(channel);

		if (isUnsubscribeValid(channel, subscribedChannel)) {
			subscribedChannel.setSubscribeOnReconnected(false);
			unsubscribe(channel, true, subscribedChannel.isWithNotification());
		}

		//subscribedChannels.remove(channel);
	}
696328
String resetSubject(long sessionId) {
    if (prefix == null) {
      return String.format("reset-%d", sessionId);
    } else {
      return String.format("%s-reset-%d", prefix, sessionId);
    }
  }
94276
public void setSubscriberID(String subscriptionID)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setSubscriberID", subscriptionID);

        this.subscriptionID = subscriptionID;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setSubscriberID");
    }
88584
def unsubscribe(self, channel):
        
        try:
            CHANNELS[channel].remove(self.socket.session.session_id)
            self.channels.remove(channel)
        except ValueError:
            return False
        return True
1298488
public function destroySession(SsoClient $ssoClient, $sessionId) {
		$serviceUri = new Uri($this->serviceBaseUri . '/session/' . urlencode($sessionId) . '/destroy');
		$serviceUri->setQuery(http_build_query(array('clientIdentifier' => $ssoClient->getServiceBaseUri())));
		$request = \TYPO3\Flow\Http\Request::create($serviceUri, 'DELETE');
		$request->setContent('');

		$signedRequest = $this->requestSigner->signRequest($request, $ssoClient->getPublicKeyFingerprint(), $ssoClient->getPublicKeyFingerprint());

		// TODO Send request asynchronously
		$response = $this->requestEngine->sendRequest($signedRequest);
		if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 404) {
			throw new Exception('Unexpected status code for destroy session when calling "' . (string)$serviceUri . '": "' . $response->getStatus() . '"', 1354132939);
		}
	}
889104
public RefreshSessionResponse refreshSession(String sessionId) {
        RefreshSessionRequest request = new RefreshSessionRequest();
        request.setSessionId(sessionId);
        return refreshSession(request);
    }
276247
@Override
    public void removeSession(String id) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            String s = id + appNameForLogging;
            LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "removeSession", s);
        }
        Object removedEntry = _sessions.remove(id);
        if (removedEntry != null) {
            _storeCallback.sessionLiveCountDec(removedEntry);
        }
    }
434446
protected void sendUnsubscribe(String topic) {
    JsonObject msg = Json.createObject().set(TYPE, "unregister").set(TOPIC, topic);
    send(msg);
  }
1088858
public void createSession(String sessionId) {
        boolean newSession = sessionId == null;
        sessionId = newSession ? newSessionId() : sessionId;
        SessionController controller = sessions.get(sessionId);
        
        if (controller == null) {
            controller = SessionController.create(sessionId, newSession);
            sessions.put(sessionId, controller);
        }
    }
154791
@Override
    public void sessionDestroyed(HttpSessionEvent event) {

        String id = event.getSession().getId();
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "HttpSession destroyed: HttpSession ID: " + event.getSession().getId());
        }

        // close the websocket session from here if the websocket session was secure.
        if (endpointManager != null) {
            endpointManager.httpSessionExpired(id);
        }
    }
1164082
public static void clearSession(final String sessionId) {

		if (StringUtils.isBlank(sessionId)) {
			return;
		}

		final App app                            = StructrApp.getInstance();
		final PropertyKey<String[]> sessionIdKey = StructrApp.key(Principal.class, "sessionIds");
		final Query<Principal> query             = app.nodeQuery(Principal.class).and(sessionIdKey, new String[]{sessionId}).disableSorting();

		try {
			for (final Principal p : query.getAsList()) {

				p.removeSessionId(sessionId);
			}

		} catch (Exception fex) {

			logger.warn("Error while removing sessionId " + sessionId + " from all principals", fex);
		}

	}
212309
public void unsubscribe_event(final DeviceProxy deviceProxy, final int event_id) throws DevFailed {
        try {
            EventConsumerUtil.getInstance().unsubscribe_event(event_id);
        } catch (final DevFailed e) {
            throw e;
        } catch (final Exception e) {
            Except.throw_communication_failed(e.toString(), "Unsubsrcibe event on event ID "
                + event_id + " Failed !", "DeviceProxy.unsubscribe_event()");
        }
    }
506771
@Override
    public java.util.concurrent.Future<UnsubscribeResult> unsubscribeAsync(String subscriptionArn,
            com.amazonaws.handlers.AsyncHandler<UnsubscribeRequest, UnsubscribeResult> asyncHandler) {

        return unsubscribeAsync(new UnsubscribeRequest().withSubscriptionArn(subscriptionArn), asyncHandler);
    }
1117921
public void invalidateAll(final String sessionId)
    {
        // tell all contexts that may have a session object with this id to
        // get rid of them
        Handler[] contexts = _server.getChildHandlersByClass(ContextHandler.class);
        for (int i = 0; contexts != null && i < contexts.length; i++)
        {
            SessionHandler sessionHandler = ((ContextHandler) contexts[i]).getChildHandlerByClass(SessionHandler.class);
            if (sessionHandler != null)
            {
                SessionManager manager = sessionHandler.getSessionManager();
                if (manager != null && manager instanceof KeyValueStoreSessionManager)
                {
                    ((KeyValueStoreSessionManager) manager).invalidateSession(sessionId);
                }
            }
        }
    }