org.springframework.websocket.CloseStatus



API Populatity

2 Client projects

Related APIs
2 java.io.IOException
Project SpringSource/spring-framework in file ...java.org.springframework.sockjs.SockJsHandler.java (2013-04-18)
@@ -16,21 +16,36 @@
 
 package org.springframework.sockjs;
 
+import org.springframework.websocket.CloseStatus;
+
 
 
 /**
+ * A handler for SockJS messages.
  *
  * @author Rossen Stoyanchev
  * @since 4.0
  */
 public interface SockJsHandler {
 
-	void newSession(SockJsSession session) throws Exception;
-
-	void handleMessage(SockJsSession session, String message) throws Exception;
-
-	void handleException(SockJsSession session, Throwable exception);
-
-	void sessionClosed(SockJsSession session);
+	/**
+	 * A new connection was opened and is ready for use.
+	 */
+	void afterConnectionEstablished(SockJsSession session) throws Exception;
+
+	/**
+	 * Handle an incoming message.
+	 */
+	void handleMessage(String message, SockJsSession session) throws Exception;
+
+	/**
+	 * TODO
+	 */
+	void handleError(Throwable exception, SockJsSession session);
+
+	/**
+	 * A connection has been closed.
+	 */
+	void afterConnectionClosed(CloseStatus status, SockJsSession session);
 
 }
Project SpringSource/spring-framework in file ...g.springframework.sockjs.SockJsHandlerAdapter.java (2013-04-18)
@@ -16,6 +16,8 @@
 
 package org.springframework.sockjs;
 
+import org.springframework.websocket.CloseStatus;
+
 
 /**
  *
@@ -25,19 +27,19 @@ package org.springframework.sockjs;
 public class SockJsHandlerAdapter implements SockJsHandler {
 
 	@Override
-	public void newSession(SockJsSession session) throws Exception {
+	public void afterConnectionEstablished(SockJsSession session) throws Exception {
 	}
 
 	@Override
-	public void handleMessage(SockJsSession session, String message) throws Exception {
+	public void handleMessage(String message, SockJsSession session) throws Exception {
 	}
 
 	@Override
-	public void handleException(SockJsSession session, Throwable exception) {
+	public void handleError(Throwable exception, SockJsSession session) {
 	}
 
 	@Override
-	public void sessionClosed(SockJsSession session) {
+	public void afterConnectionClosed(CloseStatus status, SockJsSession session) {
 	}
 
 }
Project SpringSource/spring-framework in file ...java.org.springframework.sockjs.SockJsSession.java (2013-04-18)
@@ -18,19 +18,45 @@ package org.springframework.sockjs;
 
 import java.io.IOException;
 
+import org.springframework.websocket.CloseStatus;
+
 
 
 /**
+ * Allows sending SockJS messages as well as closing the underlying connection.
  *
  * @author Rossen Stoyanchev
  * @since 4.0
  */
 public interface SockJsSession {
 
+	/**
+	 * Return a unique SockJS session identifier.
+	 */
 	String getId();
 
+	/**
+	 * Return whether the connection is still open.
+	 */
+	boolean isOpen();
+
+	/**
+	 * Send a message.
+	 */
 	void sendMessage(String text) throws IOException;
 
-	void close();
+	/**
+	 * Close the underlying connection with status 1000, i.e. equivalent to:
+	 * <pre>
+	 * session.close(CloseStatus.NORMAL);
+	 * </pre>
+	 */
+	void close() throws IOException;
+
+	/**
+	 * Close the underlying connection with the given close status.
+	 */
+	void close(CloseStatus status) throws IOException;
+
 
 }