All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.atmosphere.jboss.websockets.oio.OioWebSocket Maven / Gradle / Ivy

package org.atmosphere.jboss.websockets.oio;

import org.atmosphere.jboss.websockets.Frame;

import java.io.IOException;

/**
 * A WebSocket that blocks when you readFrame or writeFrame.  Underneath, based on java.io.* a.k.a. Old IO (Oio).
 *
 * @author Mike Brock
 * @version $Revision: 1 $
 */
public interface OioWebSocket {
  /**
   * A unique ID associated with the socket, which can be used for session association. This ID is generated by the
   * WebSockets framework as a random hash when the socket is open and has no association with any external API or
   * the websocket handshake process.
   *
   * @return A hex string representing the unique ID of the socket.
   */
  String getSocketID();

  /**
   * Read a single frame from the socket.
   *
   * @return an instance of the received {@link Frame}
   * @throws java.io.IOException
   */
  Frame readFrame() throws IOException;

  /**
   * Write a frame to the socket.
   *
   * @param frame the @{link Frame} instance to write to the socket.
   * @throws java.io.IOException
   */
  void writeFrame(Frame frame) throws IOException;

  /**
   * Terminates the connection with the client and closes the socket.
   */
  void closeSocket() throws IOException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy