Class ViteWebsocketProxy

java.lang.Object
io.jmix.flowui.devserver.ViteWebsocketProxy
All Implemented Interfaces:
jakarta.websocket.MessageHandler, jakarta.websocket.MessageHandler.Whole<String>

public class ViteWebsocketProxy extends Object implements jakarta.websocket.MessageHandler.Whole<String>
Connects a brower-server websocket connection with a server-Vite websocket connection.

Forwards all messages from one to the other.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface jakarta.websocket.MessageHandler

    jakarta.websocket.MessageHandler.Partial<T extends Object>, jakarta.websocket.MessageHandler.Whole<T extends Object>
  • Constructor Summary

    Constructors
    Constructor
    Description
    ViteWebsocketProxy(jakarta.websocket.Session browserSession, Integer vitePort, String vitePath)
    Creates a new proxy for the given browser-server websocket connection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Terminates the connection.
    protected org.slf4j.Logger
     
    void
    onMessage(String message)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ViteWebsocketProxy

      public ViteWebsocketProxy(jakarta.websocket.Session browserSession, Integer vitePort, String vitePath) throws InterruptedException, ExecutionException
      Creates a new proxy for the given browser-server websocket connection.

      Opens a connection to the Vite server running on the given port and starts forwarding messages.

      Parameters:
      browserSession - the websocket connection from the browser
      vitePort - the port the Vite server is running on
      vitePath - the path Vite is using
      Throws:
      ExecutionException - if there is a problem with the connection
      InterruptedException - if there is a problem with the connection
  • Method Details

    • getLogger

      protected org.slf4j.Logger getLogger()
    • onMessage

      public void onMessage(String message)
      Specified by:
      onMessage in interface jakarta.websocket.MessageHandler.Whole<String>
    • close

      public void close()
      Terminates the connection.