WebSocketConnection

scamper.http.websocket.WebSocketConnection
class WebSocketConnection(socket: Socket) extends AutoCloseable

Represents endpoint of WebSocket connection.

Attributes

Constructor

Create WebSocket connection using supplied socket.

Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def close(): Unit

Closes WebSocket connection.

Closes WebSocket connection.

Attributes

Note

This method does NOT send a Close frame. The user is responsible for sending an appropriate Close frame before invoking this method.

def isOpen: Boolean

Tests whether WebSocket connection is open.

Tests whether WebSocket connection is open.

Attributes

def isSecure: Boolean

Tests for secure WebSocket connection.

Tests for secure WebSocket connection.

Attributes

def read(timeout: Int): WebSocketFrame

Reads next frame from WebSocket connection.

Reads next frame from WebSocket connection.

Value parameters

timeout

timeout in milliseconds of any read operation; 0 is interpreted as indefinite

Attributes

Throws
WebSocketError

if frame is invalid or otherwise unreadable

java.io.EOFException

if unexpected EOF occurs

java.io.InterruptedIOException

if timeout is exceeded

Note

This method is synchronized on the WebSocket's input channel, permitting only one read request at a time.

def write(frame: WebSocketFrame): Unit

Writes supplied frame to WebSocket connection.

Writes supplied frame to WebSocket connection.

Value parameters

frame

WebSocket frame

Attributes

Throws
java.io.EOFException

if payload truncation is detected

Note

This method is synchronized on the WebSocket's output channel, permitting only one write request at a time.