play.api.mvc

WebSocket

Related Docs: class WebSocket | package mvc

object WebSocket extends Serializable

Helper utilities to generate WebSocket results.

Source
WebSocket.scala
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. WebSocket
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait FrameFormatter[A] extends AnyRef

    Typeclass to handle WebSocket frames format.

  2. type HandlerProps = (ActorRef) ⇒ Props

    A function that, given an actor to send upstream messages to, returns actor props to create an actor to handle the WebSocket

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. object FrameFormatter

    Defaults frame formatters.

  5. def acceptWithActor[In, Out](f: (RequestHeader) ⇒ HandlerProps)(implicit in: FrameFormatter[In], out: FrameFormatter[Out], app: Application, outMessageType: ClassTag[Out]): WebSocket[In, Out]

    Create a WebSocket that will pass messages to/from the actor created by the given props.

    Create a WebSocket that will pass messages to/from the actor created by the given props.

    Given a request and an actor ref to send messages to, the function passed should return the props for an actor to create to handle this WebSocket.

    For example:

    def webSocket = WebSocket.acceptWithActor[JsValue, JsValue] { req => out =>
      MyWebSocketActor.props(out)
    }
  6. def adapter[A](f: (RequestHeader) ⇒ Enumeratee[A, A])(implicit frameFormatter: FrameFormatter[A]): WebSocket[A, A]

    Creates a WebSocket that will adapt the incoming stream and send it back out.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

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

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

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

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  19. def toString(): String

    Definition Classes
    AnyRef → Any
  20. def tryAccept[A](f: (RequestHeader) ⇒ Future[Either[Result, (Iteratee[A, _], Enumerator[A])]])(implicit frameFormatter: FrameFormatter[A]): WebSocket[A, A]

    Creates an action that will either reject the websocket with the given result, or will be handled by the given inbound and outbound channels, asynchronously

  21. def tryAcceptWithActor[In, Out](f: (RequestHeader) ⇒ Future[Either[Result, HandlerProps]])(implicit in: FrameFormatter[In], out: FrameFormatter[Out], app: Application, outMessageType: ClassTag[Out]): WebSocket[In, Out]

    Create a WebSocket that will pass messages to/from the actor created by the given props asynchronously.

    Create a WebSocket that will pass messages to/from the actor created by the given props asynchronously.

    Given a request, this method should return a future of either:

    - A result to reject the WebSocket with, or - A function that will take the sending actor, and create the props that describe the actor to handle this WebSocket

    For example:

    def subscribe = WebSocket.tryAcceptWithActor[JsValue, JsValue] { req =>
      val isAuthenticated: Future[Boolean] = authenticate(req)
      isAuthenticated.map {
        case false => Left(Forbidden)
        case true => Right(MyWebSocketActor.props)
      }
    }
  22. def using[A](f: (RequestHeader) ⇒ (Iteratee[A, _], Enumerator[A]))(implicit frameFormatter: FrameFormatter[A]): WebSocket[A, A]

    Accepts a WebSocket using the given inbound/outbound channels.

  23. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped