Событие прихода нового сообщения. Десериализует данные, получает текущие
атрибуты сессии и проксирует запрос в сервисы.

@param msg
- сообщение.
@param session
- сессия вебсокета.
182275
@OnMessage
	public void onMessage(Dto msg, Session session) {
		try {
			messageBus.fire(session);
			messagePayloadBus.fire(msg);
		} catch (Exception e) {

			log.log(Level.SEVERE, e.getMessage(), e);
		}

	}
575683
void removeSession(JmsSessionImpl sess) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "removeSession", sess);

        synchronized (stateLock) {
            // Remove the Session
            // Note that this is a synchronized collection.
            boolean res = sessions.remove(sess);

            // Release the ordering context associated with the session
            unusedOrderingContexts.add(sess.getOrderingContext());

            if (!res && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "session not found in list");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "removeSession");
    }
994275
final void disassociateSession(final JmsJcaSessionImpl session) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "disassociateSession", session);
        }

        _sessions.remove(session);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "disassociateSession");
        }

    }
356414
public static function createRegistrationFromRegisterMessage(Session $session, RegisterMessage $msg)
    {
        $registration = new self($session, $msg->getProcedureName());
        $options      = $msg->getOptions();

        if (isset($options->disclose_caller) && $options->disclose_caller === true) {
            $registration->setDiscloseCaller(true);
        }

        if (isset($options->invoke)) {
            $registration->setInvokeType($options->invoke);
        } else {
            if (isset($options->thruway_multiregister) && $options->thruway_multiregister === true) {
                $registration->setInvokeType(self::THRUWAY_REGISTRATION);
            } else {
                $registration->setInvokeType(self::SINGLE_REGISTRATION);
            }
        }

        return $registration;
    }
302678
public static void d(String tag, Object msg) {
        log(tag, msg, Log.DEBUG);
    }
470117
public void trace(final String msg) {
        if (proxy.isTraceEnabled()) {
            if (proxy instanceof LocationAwareLogger) {
                ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.TRACE_INT, msg, null, null);
            } else {
                proxy.trace(msg);
            }
        }
    }
318978
public function handleHelloMessage(Realm $realm, Session $session, HelloMessage $msg)
    {
        $requestedMethods = $msg->getAuthMethods();
        $sentMessage      = false;

        // Go through the authmethods and try to send a response message
        foreach ($this->authMethods as $authMethod => $authMethodInfo) {
            if (in_array($authMethod, $requestedMethods)
                && (in_array($realm->getRealmName(), $authMethodInfo['auth_realms'])
                    || in_array("*", $authMethodInfo['auth_realms']))
            ) {
                $this->onHelloAuthHandler($authMethod, $authMethodInfo, $realm, $session, $msg);
                $sentMessage = true;
            }
        }

        //If we already replied with a message, we don't have to do anything else
        if ($sentMessage) {
            return;
        }

        // If no authentication providers are registered for this realm send an abort message
        if ($this->realmHasAuthProvider($realm->getRealmName())) {
            $session->abort(new \stdClass(), 'wamp.error.not_authorized');

            return;
        }

        //If we've gotten this far, it means that the user needs to be Logged in as anonymous
        $session->setAuthenticationDetails(AuthenticationDetails::createAnonymous());

        $details = new \stdClass();

        $session->sendMessage(new WelcomeMessage($session->getSessionId(), $details));
        $session->setAuthenticated(true);

    }
108946
private void updateSession(Session newSession) {
        if (this.currentSession == null) {
            this.currentSession = newSession;
        } else {
            synchronized (this.currentSession) {
                this.currentSession = newSession;
            }
        }
    }
1048979
public void addHttpSession(final HttpSession session) {
		if (View.isInitialised() && !EventQueue.isDispatchThread()) {
			EventQueue.invokeLater(new Runnable() {

				@Override
				public void run() {
					addHttpSession(session);
				}
			});

			return;
		}

		if (sessions.contains(session))
			return;
		sessions.add(session);
		final int affectedRow = sessions.size() - 1;
		fireTableRowsInserted(affectedRow, affectedRow);
	}
731485
protected function processSubscribe(Session $session, SubscribeMessage $msg)
    {
        // get a subscription group "hash"
        /** @var MatcherInterface $matcher */
        $matcher = $this->getMatcherForMatchType($msg->getMatchType());
        if ($matcher === false) {
            Logger::alert($this,
                "no matching match type for \"" . $msg->getMatchType() . "\" for URI \"" . $msg->getUri() . "\"");

            return;
        }

        if (!$matcher->uriIsValid($msg->getUri(), $msg->getOptions())) {
            $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
            $session->sendMessage($errorMsg->setErrorURI('wamp.error.invalid_uri'));

            return;
        }

        $matchHash = $matcher->getMatchHash($msg->getUri(), $msg->getOptions());

        if (!isset($this->subscriptionGroups[$matchHash])) {
            $this->subscriptionGroups[$matchHash] = new SubscriptionGroup($matcher, $msg->getUri(), $msg->getOptions());
        }

        /** @var SubscriptionGroup $subscriptionGroup */
        $subscriptionGroup = $this->subscriptionGroups[$matchHash];
        $subscription      = $subscriptionGroup->processSubscribe($session, $msg);

        $registry = $this->getStateHandlerRegistry();
        if ($registry !== null) {
            $registry->processSubscriptionAdded($subscription);
        }
    }
817855
public void onMessage(final byte[] message, final Session session) {
        final SynchronizeFXWebsocketChannel channel = getChannelOrFail(session);

        channel.newMessage(message, session);
    }
1188486
MessageToClient _createMessageToClient(MessageFromClient message, T session) {
		MessageToClient messageToClient = new MessageToClient();
		messageToClient.setId(message.getId());
		try {
			Class cls = Class.forName(message.getDataService());
			Object dataService = this.getDataService(session, cls);
			logger.debug("Process message {}", message);
			List<Object> arguments = getArrayList();
			Method method = methodServices.getMethodFromDataService(cls, message, arguments);
			injectSession(method.getParameterTypes(), arguments, session);
			messageToClient.setResult(method.invoke(dataService, arguments.toArray()));
			if (method.isAnnotationPresent(JsonMarshaller.class)) {
				messageToClient.setJson(argumentServices.getJsonResultFromSpecificMarshaller(method.getAnnotation(JsonMarshaller.class), messageToClient.getResponse()));
			}
			try {
				Method nonProxiedMethod = methodServices.getNonProxiedMethod(cls, method.getName(), method.getParameterTypes());
				messageToClient.setDeadline(cacheManager.processCacheAnnotations(nonProxiedMethod, message.getParameters()));
			} catch (NoSuchMethodException ex) {
				logger.error("Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method.getName(), ex);
			}
			logger.debug("Method {} proceed messageToClient : {}.", method.getName(), messageToClient);
		} catch (InvocationTargetException ex) {
			Throwable cause = ex.getCause();
			if (ConstraintViolationException.class.isInstance(cause)) {
				messageToClient.setConstraints(constraintServices.extractViolations((ConstraintViolationException) cause));
			} else {
				messageToClient.setFault(faultServices.buildFault(cause));
			}
		} catch (Throwable ex) {
			messageToClient.setFault(faultServices.buildFault(ex));
		}
		return messageToClient;
	}
639399
public void send(final Command msg) throws HandlerSocketException {
		Session session = this.selectSession();
		session.write(msg);
	}
278632
public void createSession(Session session) {
        sessionMap.put(session.id(), session);
        Event event = new Event();
        event.attribute("session", session);

        eventManager.fireEvent(EventType.SESSION_CREATED, event);
    }
1059646
public void destorySession(Session session) {
        session.attributes().clear();
        sessionMap.remove(session.id());

        Event event = new Event();
        event.attribute("session", session);

        eventManager.fireEvent(EventType.SESSION_DESTROY, event);
    }
721079
private function processError(Session $session, ErrorMessage $msg)
    {
        switch ($msg->getErrorMsgCode()) {
            case Message::MSG_INVOCATION:
                $this->processInvocationError($session, $msg);
                break;
            case Message::MSG_INTERRUPT:
                $this->processInterruptError($session, $msg);
                break;
        }
    }
347411
@Override
    public void messageSent(final NextFilter nextFilter,
            final IoSession session, final WriteRequest writeRequest)
            throws Exception {
        if (writeRequest.getMessage() != null
                && writeRequest.getMessage() instanceof ProxyHandshakeIoBuffer) {
            // Ignore buffers used in handshaking
            return;
        }

        nextFilter.messageSent(session, writeRequest);
    }