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 browser-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)
    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) 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
      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.