WebSocketSession

scamper.http.websocket.WebSocketSession
See theWebSocketSession companion object

Defines session for WebSocket connection.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def close(code: StatusCode): Unit

Closes session with supplied status code.

Closes session with supplied status code.

Value parameters

code

status code of closure

Attributes

def id: String

Gets session identifer.

Gets session identifer.

Attributes

def idleTimeout: Int

Gets WebSocket idle timeout in milliseconds.

Gets WebSocket idle timeout in milliseconds.

Timeout of zero disables this option – i.e., timeout is indefinite.

Attributes

Note

If no activity transpires for specified duration, then session is closed with status code GoingAway.

def idleTimeout(milliseconds: Int): WebSocketSession.this.type

Sets WebSocket idle timeout.

Sets WebSocket idle timeout.

Timeout of zero disables this option – i.e., timeout is indefinite.

Value parameters

milliseconds

idle timeout

Attributes

Returns

this session

Note

If no activity transpires for specified duration, then session is closed with status code GoingAway.

def isSecure: Boolean

Tests for secure WebSocket session.

Tests for secure WebSocket session.

Attributes

def messageCapacity: Int

Gets capacity of incoming message.

Gets capacity of incoming message.

Attributes

Note

If message exceeds specified capacity, then session is closed with status code MessageTooBig.

def messageCapacity(size: Int): WebSocketSession.this.type

Sets capacity of incoming message.

Sets capacity of incoming message.

Value parameters

size

message capacity in bytes

Attributes

Returns

this session

Note

If message exceeds specified capacity, then session is closed with status code MessageTooBig.

def onBinary[T](handler: Array[Byte] => T): WebSocketSession.this.type

Sets handler for incoming binary message.

Sets handler for incoming binary message.

Value parameters

handler

binary message handler

Attributes

Returns

this session

def onClose[T](handler: StatusCode => T): WebSocketSession.this.type

Sets handler to be notified when session closes.

Sets handler to be notified when session closes.

Value parameters

handler

close handler

Attributes

Returns

this session

def onError[T](handler: Throwable => T): WebSocketSession.this.type

Sets handler to be notified when session error occurs.

Sets handler to be notified when session error occurs.

Value parameters

handler

error handler

Attributes

Returns

this session

def onPing[T](handler: Array[Byte] => T): WebSocketSession.this.type

Sets handler for incoming ping message.

Sets handler for incoming ping message.

Value parameters

handler

ping message handler

Attributes

Returns

this session

def onPong[T](handler: Array[Byte] => T): WebSocketSession.this.type

Sets handler for incoming pong message.

Sets handler for incoming pong message.

Value parameters

handler

pong message handler

Attributes

Returns

this session

def onText[T](handler: String => T): WebSocketSession.this.type

Sets handler for incoming text message.

Sets handler for incoming text message.

Value parameters

handler

text message handler

Attributes

Returns

this session

def open(): Unit

Opens session.

Opens session.

Attributes

Note

This method becomes an effective no-op if invoked more than once.

def payloadLimit: Int

Gets payload limit of outgoing message.

Gets payload limit of outgoing message.

Attributes

Note

If outgoing message exceeds specified limit, then message is sent over multiple frames.

def payloadLimit(length: Int): WebSocketSession.this.type

Gets payload limit of outgoing message.

Gets payload limit of outgoing message.

Value parameters

length

payload limit in bytes

Attributes

Returns

this session

Note

If outgoing message exceeds specified limit, then message is sent over multiple frames.

def ping(data: Array[Byte]): Unit

Sends ping message.

Sends ping message.

Value parameters

data

application data to accompany ping message

Attributes

def pingAsync[T](data: Array[Byte]): Future[Unit]

Sends ping message asynchronously.

Sends ping message asynchronously.

Value parameters

data

application data to accompany ping message

Attributes

def pong(data: Array[Byte]): Unit

Sends pong message.

Sends pong message.

Value parameters

data

application data to accompany pong message

Attributes

def pongAsync[T](data: Array[Byte]): Future[Unit]

Sends pong message asynchronously.

Sends pong message asynchronously.

Value parameters

data

application data to accompany pong message

Attributes

def protocolVersion: String

Gets WebSocket protocol version.

Gets WebSocket protocol version.

Attributes

def send(message: String): Unit

Sends text message.

Sends text message.

Value parameters

message

text message

Attributes

def send(message: Array[Byte]): Unit

Sends binary message.

Sends binary message.

Value parameters

message

binary message

Attributes

def send(message: Reader): Unit

Sends text message.

Sends text message.

Value parameters

message

reader to message

Attributes

def send(message: InputStream): Unit

Sends binary message.

Sends binary message.

Value parameters

message

input stream to message

Attributes

def sendAsync[T](message: String): Future[Unit]

Sends text message asynchronously.

Sends text message asynchronously.

Value parameters

message

text message

Attributes

def sendAsync[T](message: Array[Byte]): Future[Unit]

Sends binary message asynchronously.

Sends binary message asynchronously.

Value parameters

message

binary message

Attributes

def sendAsync[T](message: Reader): Future[Unit]

Sends text message asynchronously.

Sends text message asynchronously.

Value parameters

message

reader to message

Attributes

def sendAsync[T](message: InputStream): Future[Unit]

Sends binary message asynchronously.

Sends binary message asynchronously.

Value parameters

message

input stream to message

Attributes

Gets current state of WebSocket session.

Gets current state of WebSocket session.

Attributes

def target: Uri

Gets target of WebSocket request.

Gets target of WebSocket request.

Attributes