Class WebsocketUtils

java.lang.Object
io.openems.common.websocket.WebsocketUtils

public class WebsocketUtils extends Object
  • Constructor Details

    • WebsocketUtils

      public WebsocketUtils()
  • Method Details

    • handshakeToJsonObject

      public static com.google.gson.JsonObject handshakeToJsonObject(org.java_websocket.handshake.Handshakedata handshake)
      Converts a Handshake to a JsonObject.

      NOTE: Per specification "Field names are case-insensitive". Because of this fields are converted to lower-case.

      Parameters:
      handshake - the Handshakedata
      Returns:
      the converted JsonObject
    • getWsDataString

      public static String getWsDataString(org.java_websocket.WebSocket ws)
      Gets the toString() content of the WsData attachment of the WebSocket; or empty string if not available.
      Parameters:
      ws - the WebSocket
      Returns:
      the WsData.toString() content