WebSocketConnection

class WebSocketConnection(socket: Socket)

Represents endpoint of WebSocket connection.

Constructor

Create WebSocket connection using supplied socket.

class Object
trait Matchable
class Any

Value members

Concrete methods

def close(): Unit

Closes WebSocket connection.

Closes WebSocket connection.

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.

def isSecure: Boolean

Tests for secure WebSocket connection.

Tests for secure WebSocket connection.

def read(timeout: Int): WebSocketFrame

Reads next frame from WebSocket connection.

Reads next frame from WebSocket connection.

Value Params
timeout

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

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 Params
frame

WebSocket frame

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.