vertx-lang-scala-docs_2.12 3.4.2 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package core
  Definition Classes
    scala
-  package http
  Definition Classes
    core
- GoAway
- Http2Settings
- HttpClient
- HttpClientOptions
- HttpClientRequest
- HttpClientResponse
- HttpConnection
- HttpFrame
- HttpServer
- HttpServerFileUpload
- HttpServerOptions
- HttpServerRequest
- HttpServerResponse
- RequestOptions
- ServerWebSocket
- WebSocket
- WebSocketBase
- WebSocketFrame

c

io.vertx.scala.core.http

# WebSocket 

###
Companion object WebSocket

#### class WebSocket extends WebSocketBase

Represents a client-side WebSocket.

Linear Supertypes
WebSocketBase, WriteStream[Buffer], ReadStream[Buffer], StreamBase, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. WebSocket
2. WebSocketBase
3. WriteStream
4. ReadStream
5. StreamBase
6. AnyRef
7. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new WebSocket(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
   Definition Classes
     WebSocket → WebSocketBase → WriteStream → ReadStream → StreamBase
6.  def binaryHandlerID(): String

   When a `Websocket` is created it automatically registers an event handler with the event bus - the ID of that handler is given by this method.

   When a `Websocket` is created it automatically registers an event handler with the event bus - the ID of that handler is given by this method.

   Given this ID, a different event loop can send a binary frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.

   returns

     the binary handler id

   Definition Classes
     WebSocket → WebSocketBase
7.  def binaryMessageHandler(handler: Handler[Buffer]): WebSocketBase

   Set a binary message handler on the connection.

   Set a binary message handler on the connection. This handler serves a similar purpose to io.vertx.scala.core.http.WebSocket#handler except that if a message comes into the socket in multiple frames, the data from the frames will be aggregated into a single buffer before calling the handler (using io.vertx.scala.core.http.WebSocketFrame#isFinal to find the boundaries).

   handler

     the handler

   returns

     a reference to this, so the API can be used fluently

   Definition Classes
     WebSocket → WebSocketBase
8.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... )
9.  def close(): Unit

   Close the WebSocket.

   Close the WebSocket.

   Definition Classes
     WebSocket → WebSocketBase
10.  def closeHandler(handler: Handler[Unit]): WebSocket

    Set a close handler.

    Set a close handler. This will be called when the WebSocket is closed.

    handler

      the handler

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase
11.  def drainHandler(handler: Handler[Unit]): WebSocket

    Set a drain handler on the stream.

    Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See io.vertx.scala.core.streams.Pump for an example of this being used.

    The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to `maxSize / 2`.

    handler

      the handler

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → WriteStream
12.  def end(): Unit

    Calls io.vertx.scala.core.http.WebSocketBase#close

    Calls io.vertx.scala.core.http.WebSocketBase#close

    Definition Classes
      WebSocket → WebSocketBase → WriteStream
13.  def end(t: Buffer): Unit

    Same as io.vertx.scala.core.http.WebSocketBase#end but writes some data to the stream before ending.

    Same as io.vertx.scala.core.http.WebSocketBase#end but writes some data to the stream before ending.

    Definition Classes
      WebSocket → WebSocketBase → WriteStream
14.  def endHandler(endHandler: Handler[Unit]): WebSocket

    Set an end handler.

    Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → ReadStream
15.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
16.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
17.  def exceptionHandler(handler: Handler[Throwable]): WebSocket

    Set an exception handler on the write stream.

    Set an exception handler on the write stream.

    handler

      the exception handler

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → WriteStream → ReadStream → StreamBase
18.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
19.  def frameHandler(handler: Handler[WebSocketFrame]): WebSocket

    Set a frame handler on the connection.

    Set a frame handler on the connection. This handler will be called when frames are read on the connection.

    handler

      the handler

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase
20.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
21.  def handler(handler: Handler[Buffer]): WebSocket

    Set a data handler.

    Set a data handler. As data is read, the handler will be called with the data.

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → ReadStream
22.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
23.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
24.  def isSsl(): Boolean

    returns

      true if this io.vertx.scala.core.http.HttpConnection is encrypted via SSL/TLS.

    Definition Classes
      WebSocket → WebSocketBase
25.  def localAddress(): SocketAddress

    returns

      the local address for this socket

    Definition Classes
      WebSocket → WebSocketBase
26.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
27.  final def notify(): Unit
    Definition Classes
      AnyRef
28.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
29.  def pause(): WebSocket

    Pause the `ReadSupport`.

    Pause the `ReadSupport`. While it's paused, no data will be sent to the `dataHandler`

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → ReadStream
30.  def remoteAddress(): SocketAddress

    returns

      the remote address for this socket

    Definition Classes
      WebSocket → WebSocketBase
31.  def resume(): WebSocket

    Resume reading.

    Resume reading. If the `ReadSupport` has been paused, reading will recommence on it.

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → ReadStream
32.  def setWriteQueueMaxSize(maxSize: Int): WebSocket

    Set the maximum size of the write queue to `maxSize`.

    Set the maximum size of the write queue to `maxSize`. You will still be able to write to the stream even if there is more than `maxSize` items in the write queue. This is used as an indicator by classes such as `Pump` to provide flow control.

    The value is defined by the implementation of the stream, e.g in bytes for a io.vertx.scala.core.net.NetSocket, the number of io.vertx.scala.core.eventbus.Message for a io.vertx.scala.core.eventbus.MessageProducer, etc...

    maxSize

      the max size of the write stream

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → WriteStream
33.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
34.  def textHandlerID(): String

    When a `Websocket` is created it automatically registers an event handler with the eventbus, the ID of that handler is given by `textHandlerID`.

    When a `Websocket` is created it automatically registers an event handler with the eventbus, the ID of that handler is given by `textHandlerID`.

    Given this ID, a different event loop can send a text frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.

    Definition Classes
      WebSocket → WebSocketBase
35.  def textMessageHandler(handler: Handler[String]): WebSocketBase

    Set a text message handler on the connection.

    Set a text message handler on the connection. This handler will be called similar to the , but the buffer will be converted to a String first

    handler

      the handler

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase
36.  def toString(): String
    Definition Classes
      AnyRef → Any
37.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
38.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
39.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
40.  def write(data: Buffer): WebSocket

    Write some data to the stream.

    Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the io.vertx.scala.core.streams.WriteStream#writeQueueFull method before writing. This is done automatically if using a io.vertx.scala.core.streams.Pump.

    data

      the data to write

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase → WriteStream
41.  def writeBinaryMessage(data: Buffer): WebSocket

    Writes a (potentially large) piece of binary data to the connection.

    Writes a (potentially large) piece of binary data to the connection. This data might be written as multiple frames if it exceeds the maximum WebSocket frame size.

    data

      the data to write

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase
42.  def writeFinalBinaryFrame(data: Buffer): WebSocket

    Write a final WebSocket binary frame to the connection

    Write a final WebSocket binary frame to the connection

    data

      The data to write

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase
43.  def writeFinalTextFrame(text: String): WebSocket

    Write a final WebSocket text frame to the connection

    Write a final WebSocket text frame to the connection

    text

      The text to write

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase
44.  def writeFrame(frame: WebSocketFrame): WebSocket

    Write a WebSocket frame to the connection

    Write a WebSocket frame to the connection

    frame

      the frame to write

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase
45.  def writeQueueFull(): Boolean

    This will return `true` if there are more bytes in the write queue than the value set using io.vertx.scala.core.http.WebSocket#setWriteQueueMaxSize

    This will return `true` if there are more bytes in the write queue than the value set using io.vertx.scala.core.http.WebSocket#setWriteQueueMaxSize

    returns

      true if write queue is full

    Definition Classes
      WebSocket → WebSocketBase → WriteStream
46.  def writeTextMessage(text: String): WebSocket

    Writes a (potentially large) piece of text data to the connection.

    Writes a (potentially large) piece of text data to the connection. This data might be written as multiple frames if it exceeds the maximum WebSocket frame size.

    text

      the data to write

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      WebSocket → WebSocketBase

### Inherited from WebSocketBase

### Inherited from WriteStream[Buffer]

### Inherited from ReadStream[Buffer]

### Inherited from StreamBase

### Inherited from AnyRef

### Inherited from Any

### Ungrouped