phoenix_live_view
    Preparing search index...

    Class LiveSocket

    Index

    Constructors

    • Creates a new LiveSocket instance.

      Parameters

      • url: string

        The WebSocket endpoint URL, e.g., "wss://example.com/live", or "/live" to inherit the host and protocol.

      • phxSocket: typeof Socket

        The required Phoenix Socket class imported from "phoenix". For example:

        import {Socket} from "phoenix"
        import {LiveSocket} from "phoenix_live_view"
        let liveSocket = new LiveSocket("/live", Socket, {...})
      • opts: Partial<LiveSocketOptions> = {}

        Optional configuration.

      Returns LiveSocket

    Properties

    socket: Socket

    Methods

    • Disables latency simulation.

      Returns void

    • Disconnects from the LiveView server.

      Parameters

      • Optionalcallback: () => void

      Returns void

    • Enables debugging.

      When debugging is enabled, the LiveView client will log debug information to the console. See Debugging client events for more information.

      Returns void

    • Enables latency simulation.

      When latency simulation is enabled, the LiveView client will add a delay to requests and responses from the server. See Simulating Latency for more information.

      Parameters

      • upperBoundMs: number

      Returns void

    • Enables profiling.

      When profiling is enabled, the LiveView client will log profiling information to the console.

      Returns void

    • Executes an encoded JS command, targeting the given element.

      See Phoenix.LiveView.JS for more information.

      Parameters

      • el: Element
      • encodedJS: EncodedJS
      • eventType: string = null

      Returns void

    • Returns the current latency simulation upper bound.

      Returns number

    • Returns the Phoenix Socket instance.

      Returns Socket

    • Can be used to replace the transport used by the underlying Phoenix Socket.

      Parameters

      • transport: any

      Returns void

    • Returns the version of the LiveView client.

      Returns string