1
1
/*
2
- * Copyright 2002-2013 the original author or authors.
2
+ * Copyright 2002-2014 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package org .springframework .web .socket ;
18
18
19
+ import java .io .Closeable ;
19
20
import java .io .IOException ;
20
21
import java .net .InetSocketAddress ;
21
22
import java .net .URI ;
32
33
* @author Rossen Stoyanchev
33
34
* @since 4.0
34
35
*/
35
- public interface WebSocketSession {
36
+ public interface WebSocketSession extends Closeable {
36
37
37
38
/**
38
39
* Return a unique session identifier.
@@ -51,12 +52,10 @@ public interface WebSocketSession {
51
52
52
53
/**
53
54
* Return the map with attributes associated with the WebSocket session.
54
- *
55
55
* <p>When the WebSocketSession is created, on the server side, the map can be
56
56
* through a {@link org.springframework.web.socket.server.HandshakeInterceptor}.
57
57
* On the client side, the map can be populated by passing attributes to the
58
- * {@link org.springframework.web.socket.client.WebSocketClient} handshake
59
- * methods.
58
+ * {@link org.springframework.web.socket.client.WebSocketClient} handshake methods.
60
59
*/
61
60
Map <String , Object > getAttributes ();
62
61
@@ -110,22 +109,22 @@ public interface WebSocketSession {
110
109
List <WebSocketExtension > getExtensions ();
111
110
112
111
/**
113
- * Return whether the connection is still open .
112
+ * Send a WebSocket message: either {@link TextMessage} or {@link BinaryMessage} .
114
113
*/
115
- boolean isOpen () ;
114
+ void sendMessage ( WebSocketMessage <?> message ) throws IOException ;
116
115
117
116
/**
118
- * Send a WebSocket message either {@link TextMessage} or
119
- * {@link BinaryMessage}.
117
+ * Return whether the connection is still open.
120
118
*/
121
- void sendMessage ( WebSocketMessage <?> message ) throws IOException ;
119
+ boolean isOpen () ;
122
120
123
121
/**
124
122
* Close the WebSocket connection with status 1000, i.e. equivalent to:
125
123
* <pre class="code">
126
124
* session.close(CloseStatus.NORMAL);
127
125
* </pre>
128
126
*/
127
+ @ Override
129
128
void close () throws IOException ;
130
129
131
130
/**
0 commit comments