Я использую библиотеку Spring 4 + Websockets + Stomp JS. Я не смог найти способ настроить механизм ping/pong веб-сокета (пульс).
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans" ...">
<websocket:message-broker>
<websocket:stomp-endpoint path="/cors/auth/clientEndpoint">
<websocket:handshake-handler ref="myHandshakeHandler" />
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/queue, /topic" />
<websocket:client-inbound-channel>
<websocket:interceptors>
<bean class="com.mycompany.myproject.utils.messaging.MyInboundChannelInterception"></bean>
</websocket:interceptors>
</websocket:client-inbound-channel>
</websocket:message-broker>
<bean id="myHandshakeHandler" class="com.mycompany.myproject.utils.security.MyHandshakeHandler" />
<bean class="org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean">
<property name="maxSessionIdleTimeout" value="120000" />
</bean>
As result, I am implementing my own mechanism of ping/pong messages.
Одна из задач здесь - реализовать закрытие вебсокета на стороне сервера в случае отсутствия пинга от клиента более 10 секунд.
И нет способа сделать это с помощью Spring Websockets!
Может быть, кто-нибудь может сказать мне, как получить доступ к объекту сеанса пользователя или закрыть этот сеанс через Spring Websockets?
Кажется, весна здесь очень ограничена.