接口的使用
org.springframework.web.socket.WebSocketSession
使用WebSocketSession的程序包 程序包 说明 org.springframework.web.socket Common abstractions and Spring configuration support for WebSocket applications.org.springframework.web.socket.adapter Classes adapting Spring's WebSocket API to and from WebSocket providers.org.springframework.web.socket.adapter.jetty Adapter classes for the Jetty WebSocket API.org.springframework.web.socket.adapter.standard Adapter classes for the standard Java WebSocket API.org.springframework.web.socket.client Client-side abstractions for WebSocket applications.org.springframework.web.socket.client.jetty Client-side support for the Jetty WebSocket API.org.springframework.web.socket.client.standard Client-side classes for use with standard Java WebSocket endpoints.org.springframework.web.socket.handler ConvenientWebSocketHandlerimplementations and decorators.org.springframework.web.socket.messaging WebSocket integration for Spring's messaging module.org.springframework.web.socket.sockjs.client SockJS client implementation ofWebSocketClient.org.springframework.web.socket.sockjs.transport Server-side support for SockJS transports includingTransportHandlerimplementations for processing incoming requests, theirsessioncounterparts for sending messages over the various transports, andDefaultSockJsService.org.springframework.web.socket.sockjs.transport.handler TransportHandlerimplementation classes as well as a concreteSockJsService.org.springframework.web.socket.sockjs.transport.session SockJS specific implementations ofWebSocketSession.org.springframework.web.socket中WebSocketSession的使用
参数类型为WebSocketSession的org.springframework.web.socket中的方法 修饰符和类型 方法 说明 voidWebSocketHandler. afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred.voidWebSocketHandler. afterConnectionEstablished(WebSocketSession session)Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.voidWebSocketHandler. handleMessage(WebSocketSession session, WebSocketMessage<?> message)Invoked when a new WebSocket message arrives.voidWebSocketHandler. handleTransportError(WebSocketSession session, Throwable exception)Handle an error from the underlying WebSocket message transport.org.springframework.web.socket.adapter中WebSocketSession的使用
org.springframework.web.socket.adapter中WebSocketSession的子接口 修饰符和类型 接口 说明 interfaceNativeWebSocketSessionAWebSocketSessionthat exposes the underlying, native WebSocketSession through a getter.实现WebSocketSession的org.springframework.web.socket.adapter中的类 修饰符和类型 类 说明 classAbstractWebSocketSession<T>An abstract base class for implementations ofWebSocketSession.org.springframework.web.socket.adapter.jetty中WebSocketSession的使用
实现WebSocketSession的org.springframework.web.socket.adapter.jetty中的类 修饰符和类型 类 说明 classJettyWebSocketSessionAWebSocketSessionfor use with the Jetty 9.4 WebSocket API.org.springframework.web.socket.adapter.standard中WebSocketSession的使用
实现WebSocketSession的org.springframework.web.socket.adapter.standard中的类 修饰符和类型 类 说明 classStandardWebSocketSessionAWebSocketSessionfor use with the standard WebSocket for Java API.org.springframework.web.socket.client中WebSocketSession的使用
返回变量类型为WebSocketSession的类型的org.springframework.web.socket.client中的方法 修饰符和类型 方法 说明 ListenableFuture<WebSocketSession>AbstractWebSocketClient. doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars)ListenableFuture<WebSocketSession>AbstractWebSocketClient. doHandshake(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri)ListenableFuture<WebSocketSession>WebSocketClient. doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables)ListenableFuture<WebSocketSession>WebSocketClient. doHandshake(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri)protected abstract ListenableFuture<WebSocketSession>AbstractWebSocketClient. doHandshakeInternal(WebSocketHandler webSocketHandler, HttpHeaders headers, URI uri, List<String> subProtocols, List<WebSocketExtension> extensions, Map<String,Object> attributes)Perform the actual handshake to establish a connection to the server.org.springframework.web.socket.client.jetty中WebSocketSession的使用
返回变量类型为WebSocketSession的类型的org.springframework.web.socket.client.jetty中的方法 修饰符和类型 方法 说明 ListenableFuture<WebSocketSession>JettyWebSocketClient. doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars)ListenableFuture<WebSocketSession>JettyWebSocketClient. doHandshakeInternal(WebSocketHandler wsHandler, HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions, Map<String,Object> attributes)org.springframework.web.socket.client.standard中WebSocketSession的使用
返回变量类型为WebSocketSession的类型的org.springframework.web.socket.client.standard中的方法 修饰符和类型 方法 说明 protected ListenableFuture<WebSocketSession>StandardWebSocketClient. doHandshakeInternal(WebSocketHandler webSocketHandler, HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions, Map<String,Object> attributes)org.springframework.web.socket.handler中WebSocketSession的使用
实现WebSocketSession的org.springframework.web.socket.handler中的类 修饰符和类型 类 说明 classConcurrentWebSocketSessionDecoratorWrap aWebSocketSessionto guarantee only one thread can send messages at a time.classWebSocketSessionDecoratorWraps anotherWebSocketSessioninstance and delegates to it.返回WebSocketSession的org.springframework.web.socket.handler中的方法 修饰符和类型 方法 说明 WebSocketSessionWebSocketSessionDecorator. getDelegate()WebSocketSessionWebSocketSessionDecorator. getLastSession()static WebSocketSessionWebSocketSessionDecorator. unwrap(WebSocketSession session)参数类型为WebSocketSession的org.springframework.web.socket.handler中的方法 修饰符和类型 方法 说明 voidAbstractWebSocketHandler. afterConnectionClosed(WebSocketSession session, CloseStatus status)voidExceptionWebSocketHandlerDecorator. afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)voidLoggingWebSocketHandlerDecorator. afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)voidPerConnectionWebSocketHandler. afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)voidWebSocketHandlerDecorator. afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)voidAbstractWebSocketHandler. afterConnectionEstablished(WebSocketSession session)voidExceptionWebSocketHandlerDecorator. afterConnectionEstablished(WebSocketSession session)voidLoggingWebSocketHandlerDecorator. afterConnectionEstablished(WebSocketSession session)voidPerConnectionWebSocketHandler. afterConnectionEstablished(WebSocketSession session)voidWebSocketHandlerDecorator. afterConnectionEstablished(WebSocketSession session)protected voidAbstractWebSocketHandler. handleBinaryMessage(WebSocketSession session, BinaryMessage message)protected voidTextWebSocketHandler. handleBinaryMessage(WebSocketSession session, BinaryMessage message)voidAbstractWebSocketHandler. handleMessage(WebSocketSession session, WebSocketMessage<?> message)voidExceptionWebSocketHandlerDecorator. handleMessage(WebSocketSession session, WebSocketMessage<?> message)voidLoggingWebSocketHandlerDecorator. handleMessage(WebSocketSession session, WebSocketMessage<?> message)voidPerConnectionWebSocketHandler. handleMessage(WebSocketSession session, WebSocketMessage<?> message)voidWebSocketHandlerDecorator. handleMessage(WebSocketSession session, WebSocketMessage<?> message)protected voidAbstractWebSocketHandler. handlePongMessage(WebSocketSession session, PongMessage message)protected voidAbstractWebSocketHandler. handleTextMessage(WebSocketSession session, TextMessage message)protected voidBinaryWebSocketHandler. handleTextMessage(WebSocketSession session, TextMessage message)voidAbstractWebSocketHandler. handleTransportError(WebSocketSession session, Throwable exception)voidExceptionWebSocketHandlerDecorator. handleTransportError(WebSocketSession session, Throwable exception)voidLoggingWebSocketHandlerDecorator. handleTransportError(WebSocketSession session, Throwable exception)voidPerConnectionWebSocketHandler. handleTransportError(WebSocketSession session, Throwable exception)voidWebSocketHandlerDecorator. handleTransportError(WebSocketSession session, Throwable exception)static voidExceptionWebSocketHandlerDecorator. tryCloseWithError(WebSocketSession session, Throwable exception, Log logger)static WebSocketSessionWebSocketSessionDecorator. unwrap(WebSocketSession session)参数类型为WebSocketSession的org.springframework.web.socket.handler中的构造器 构造器 说明 ConcurrentWebSocketSessionDecorator(WebSocketSession delegate, int sendTimeLimit, int bufferSizeLimit)Basic constructor.ConcurrentWebSocketSessionDecorator(WebSocketSession delegate, int sendTimeLimit, int bufferSizeLimit, ConcurrentWebSocketSessionDecorator.OverflowStrategy overflowStrategy)Constructor that also specifies the overflow strategy to use.WebSocketSessionDecorator(WebSocketSession session)org.springframework.web.socket.messaging中WebSocketSession的使用
返回WebSocketSession的org.springframework.web.socket.messaging中的方法 修饰符和类型 方法 说明 protected WebSocketSessionSubProtocolWebSocketHandler. decorateSession(WebSocketSession session)Decorate the givenWebSocketSession, if desired.参数类型为WebSocketSession的org.springframework.web.socket.messaging中的方法 修饰符和类型 方法 说明 voidSubProtocolWebSocketHandler. afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)voidSubProtocolWebSocketHandler. afterConnectionEstablished(WebSocketSession session)voidStompSubProtocolHandler. afterSessionEnded(WebSocketSession session, CloseStatus closeStatus, MessageChannel outputChannel)voidSubProtocolHandler. afterSessionEnded(WebSocketSession session, CloseStatus closeStatus, MessageChannel outputChannel)Invoked after aWebSocketSessionhas ended.voidStompSubProtocolHandler. afterSessionStarted(WebSocketSession session, MessageChannel outputChannel)voidSubProtocolHandler. afterSessionStarted(WebSocketSession session, MessageChannel outputChannel)Invoked after aWebSocketSessionhas started.protected WebSocketSessionSubProtocolWebSocketHandler. decorateSession(WebSocketSession session)Decorate the givenWebSocketSession, if desired.protected SubProtocolHandlerSubProtocolWebSocketHandler. findProtocolHandler(WebSocketSession session)Find aSubProtocolHandlerfor the given session.voidSubProtocolWebSocketHandler. handleMessage(WebSocketSession session, WebSocketMessage<?> message)Handle an inbound message from a WebSocket client.voidStompSubProtocolHandler. handleMessageFromClient(WebSocketSession session, WebSocketMessage<?> webSocketMessage, MessageChannel outputChannel)Handle incoming WebSocket messages from clients.voidSubProtocolHandler. handleMessageFromClient(WebSocketSession session, WebSocketMessage<?> message, MessageChannel outputChannel)Handle the givenWebSocketMessagereceived from a client.voidStompSubProtocolHandler. handleMessageToClient(WebSocketSession session, Message<?> message)Handle STOMP messages going back out to WebSocket clients.voidSubProtocolHandler. handleMessageToClient(WebSocketSession session, Message<?> message)Handle the givenMessageto the client associated with the given WebSocket session.voidSubProtocolWebSocketHandler. handleTransportError(WebSocketSession session, Throwable exception)org.springframework.web.socket.sockjs.client中WebSocketSession的使用
实现WebSocketSession的org.springframework.web.socket.sockjs.client中的类 修饰符和类型 类 说明 classAbstractClientSockJsSessionBase class for SockJS client implementations ofWebSocketSession.classWebSocketClientSockJsSessionAn extension ofAbstractClientSockJsSessionwrapping and delegating to an actual WebSocket session.classXhrClientSockJsSessionAn extension ofAbstractClientSockJsSessionfor use with HTTP transports simulating a WebSocket session.返回变量类型为WebSocketSession的类型的org.springframework.web.socket.sockjs.client中的方法 修饰符和类型 方法 说明 ListenableFuture<WebSocketSession>AbstractXhrTransport. connect(TransportRequest request, WebSocketHandler handler)ListenableFuture<WebSocketSession>Transport. connect(TransportRequest request, WebSocketHandler webSocketHandler)Connect the transport.ListenableFuture<WebSocketSession>WebSocketTransport. connect(TransportRequest request, WebSocketHandler handler)ListenableFuture<WebSocketSession>SockJsClient. doHandshake(WebSocketHandler handler, String uriTemplate, Object... uriVars)ListenableFuture<WebSocketSession>SockJsClient. doHandshake(WebSocketHandler handler, WebSocketHttpHeaders headers, URI url)参数类型为WebSocketSession的org.springframework.web.socket.sockjs.client中的方法 修饰符和类型 方法 说明 voidWebSocketClientSockJsSession. initializeDelegateSession(WebSocketSession session)类型变量类型为WebSocketSession的org.springframework.web.socket.sockjs.client中的构造器参数 构造器 说明 AbstractClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture)WebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture)XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, SettableListenableFuture<WebSocketSession> connectFuture)org.springframework.web.socket.sockjs.transport中WebSocketSession的使用
org.springframework.web.socket.sockjs.transport中WebSocketSession的子接口 修饰符和类型 接口 说明 interfaceSockJsSessionSockJS extension of Spring's standardWebSocketSession.org.springframework.web.socket.sockjs.transport.handler中WebSocketSession的使用
参数类型为WebSocketSession的org.springframework.web.socket.sockjs.transport.handler中的方法 修饰符和类型 方法 说明 voidSockJsWebSocketHandler. afterConnectionClosed(WebSocketSession wsSession, CloseStatus status)voidSockJsWebSocketHandler. afterConnectionEstablished(WebSocketSession wsSession)voidSockJsWebSocketHandler. handleTextMessage(WebSocketSession wsSession, TextMessage message)voidSockJsWebSocketHandler. handleTransportError(WebSocketSession webSocketSession, Throwable exception)org.springframework.web.socket.sockjs.transport.session中WebSocketSession的使用
实现WebSocketSession的org.springframework.web.socket.sockjs.transport.session中的类 修饰符和类型 类 说明 classAbstractHttpSockJsSessionAn abstract base class for use with HTTP transport SockJS sessions.classAbstractSockJsSessionAn abstract base class for SockJS sessions implementingSockJsSession.classPollingSockJsSessionA SockJS session for use with polling HTTP transports.classStreamingSockJsSessionA SockJS session for use with streaming HTTP transports.classWebSocketServerSockJsSessionA SockJS session for use with the WebSocket transport.参数类型为WebSocketSession的org.springframework.web.socket.sockjs.transport.session中的方法 修饰符和类型 方法 说明 voidWebSocketServerSockJsSession. handleMessage(TextMessage message, WebSocketSession wsSession)voidWebSocketServerSockJsSession. initializeDelegateSession(WebSocketSession session)