object impl
- Source
- WebSocket.scala
- Alphabetic
- By Inheritance
- impl
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def computeFingerPrint(key: ByteVector): ByteVector
-
def
computeHandshakeResponse(header: HttpRequestHeader, key: ByteVector): HttpResponseHeader
creates the handshake response to complete websocket handshake on server side *
-
def
controlStream[F[_]](pingPongs: Stream[F, PingPong], metronome: Stream[F, Unit], maxUnanswered: Int, flag: Boolean)(implicit F: Async[F]): Stream[F, WebSocketFrame]
Creates control stream.
Creates control stream. When control stream terminates WebSocket will terminate too.
This takes ping-pong stream, for each Ping, this responds with Pong. For each Pong received this zeroes number of pings sent.
- pingPongs
Stream of ping pongs received
- metronome
A metronome that emits time to send Ping
- maxUnanswered
Max unanswered pings to await before the stream terminates.
-
def
createRequestHeaders(header: HttpRequestHeader, random: ⇒ ByteVector = randomBytes(16)): (HttpRequestHeader, ByteVector)
Augments header to be correct for Websocket request (adding Sec-WebSocket-Key header) and returnng the correct header with expected SHA-1 response from the server
Augments header to be correct for Websocket request (adding Sec-WebSocket-Key header) and returnng the correct header with expected SHA-1 response from the server
- random
Random generator of 16 byte websocket keys
-
def
cutFrame(in: ByteVector): Option[ByteVector]
Cuts necessary data for decoding the frame, done by partially decoding the frame Empty if the data couldn't be decoded yet
Cuts necessary data for decoding the frame, done by partially decoding the frame Empty if the data couldn't be decoded yet
- in
Current buffer that may contain full frame
-
def
decodeWebSocketFrame[F[_]](maxFrameSize: Int, flag: Boolean): Pipe[F, Byte, WebSocketFrame]
Decodes websocket frame.
Decodes websocket frame.
This will fail when the frame failed to be decoded or when frame is larger than supplied
maxFrameSize
parameter.- maxFrameSize
Maximum size of the frame, including its header.
-
def
encodeWebSocketFrame[F[_]](flag: Boolean): Pipe[F, WebSocketFrame, Byte]
Encodes incoming frames to wire format.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
frame2WebSocketFrame[F[_], A](maskKey: ⇒ Option[Int])(implicit W: Encoder[A]): Pipe[F, Frame[A], WebSocketFrame]
Encodes received frome to WebSocketFrame.
Encodes received frome to WebSocketFrame.
- maskKey
A funtion that allows to generate random masking key. Masking is applied at client -> server direction only.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val magic: ByteVector
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
randomBytes(size: Int): ByteVector
random generator, ascii compatible *
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
validateResponse[F[_]](request: HttpRequestHeader, response: HttpResponseHeader, expectFingerPrint: ByteVector): Stream[F, Option[HttpResponseHeader]]
Validates response received.
Validates response received. If other than 101 status code is received, this evaluates to Some() If fingerprint won't match or the websocket headers wont match the request, this fails.
- request
Sent request header
- response
received header
- expectFingerPrint
expected fingerprint in header
-
def
verifyHeaderRequest[F[_]](header: HttpRequestHeader): Either[HttpResponse[F], ByteVector]
Verifies validity of WebSocket header request (on server) and extracts WebSocket key
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
webSocketFrame2Frame[F[_], A](pongQ: Queue[F, PingPong])(implicit R: Decoder[A]): Pipe[F, WebSocketFrame, Frame[A]]
Collects incoming frames.
Collects incoming frames. to produce and deserialize Frame[A].
Also interprets WebSocket operations.
- if Ping is received, supplied Queue is enqueued with true
- if Pong is received, supplied Queue is enqueued with false
- if Close is received, the WebSocket is terminated
- if Continuation is received, the buffer of the frame is enqueued and later used to deserialize to
A
.
- pongQ
Queue to notify about ping/pong frames.
-
def
webSocketOf[F[_], I, O](pipe: Pipe[F, Frame[I], Frame[O]], pingInterval: Duration, maxFrameSize: Int, client2Server: Boolean)(implicit R: Decoder[I], W: Encoder[O], F: Async[F], S: Scheduler): Pipe[F, Byte, Byte]
Creates websocket of supplied pipe
Creates websocket of supplied pipe
- pingInterval
If Finite, defines duration when keep-alive pings are sent to client If client won't respond with pong to 3x this internal, the websocket will be terminated by server.
- client2Server
When true, this represent client -> server direction, when false this represents reverse direction