Class/Object

io.scalajs.dom.ws

WebSocket

Related Docs: object WebSocket | package ws

Permalink

class WebSocket extends Object

The WebSocket object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

Annotations
@RawJSType() @native()
See also

https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API

Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WebSocket
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new WebSocket(endpoint: String, protocols: String*)

    Permalink

    endpoint

    The URL to which to connect; this should be the URL to which the WebSocket server will respond.

    protocols

    Either a single protocol string or an array of protocol strings. These strings are used to indicate sub-protocols, so that a single server can implement multiple WebSocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the specified protocol). If you don't specify a protocol string, an empty string is assumed.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def binaryType: String

    Permalink

    A string indicating the type of binary data being transmitted by the connection.

    A string indicating the type of binary data being transmitted by the connection. This should be either "blob" if DOM Blob objects are being used or "arraybuffer" if ArrayBuffer objects are being used.

  6. def bufferedAmount: Long

    Permalink

    The number of bytes of data that have been queued using calls to send() but not yet transmitted to the network.

    The number of bytes of data that have been queued using calls to send() but not yet transmitted to the network. This value resets to zero once all queued data has been sent. This value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb. Read only.

  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def close(code: Int = js.native, reason: String = js.native): Unit

    Permalink

    Closes the WebSocket connection or connection attempt, if any.

    Closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.

    code

    Optional: A numeric value indicating the status code explaining why the connection is being closed. If this parameter is not specified, a default value of 1000 (indicating a normal "transaction complete" closure) is assumed. See the list of status codes on the CloseEvent page for permitted values.

    reason

    Optional: A human-readable string explaining why the connection is closing. This string must be no longer than 123 bytes of UTF-8 text (not characters).

  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def extensions: String

    Permalink

    The extensions selected by the server.

    The extensions selected by the server. This is currently only the empty string or a list of extensions as negotiated by the connection.

  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. var onclose: Function1[CloseEvent, Any]

    Permalink

    An event listener to be called when the WebSocket connection's readyState changes to CLOSED.

    An event listener to be called when the WebSocket connection's readyState changes to CLOSED. The listener receives a CloseEvent named "close".

  22. var onerror: Function1[ErrorEvent, Any]

    Permalink

    An event listener to be called when an error occurs.

    An event listener to be called when an error occurs. This is a simple event named "error".

  23. var onmessage: Function1[MessageEvent, Any]

    Permalink

    An event listener to be called when a message is received from the server.

    An event listener to be called when a message is received from the server. The listener receives a MessageEvent named "message".

  24. var onopen: Function1[OpenEvent, Any]

    Permalink

    An event listener to be called when the WebSocket connection's readyState changes to OPEN; this indicates that the connection is ready to send and receive data.

    An event listener to be called when the WebSocket connection's readyState changes to OPEN; this indicates that the connection is ready to send and receive data. The event is a simple one with the name "open".

  25. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  26. def protocol: String

    Permalink

    A string indicating the name of the sub-protocol the server selected; this will be one of the strings specified in the protocols parameter when creating the WebSocket object.

  27. def readyState: Int

    Permalink

    The current state of the connection; this is one of the Ready state constants.

    The current state of the connection; this is one of the Ready state constants. Read only.

  28. def send(data: |[|[String, ArrayBuffer], Blob]): Unit

    Permalink

    Transmits data to the server over the WebSocket connection.

    Transmits data to the server over the WebSocket connection.

    data

    A text string to send to the server.

  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  31. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  32. def url: String

    Permalink

    The URL as resolved by the constructor.

    The URL as resolved by the constructor. This is always an absolute URL. Read only.

  33. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  34. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped