Class GroovyWebSocketTopic

java.lang.Object
de.uplanet.lucy.server.websocket.groovy.GroovyWebSocketTopic

@Scriptable public final class GroovyWebSocketTopic extends Object
  • Method Details

    • sendTextMessage

      public static void sendTextMessage(String p_strTopicGuid, String p_strData)
      Send a text message to the client.
      Parameters:
      p_strTopicGuid - The GUID of the WebSocket topic.
      p_strData - The text data to be sent to the client (must not be null).
    • sendJsonMessage

      public static String sendJsonMessage(String p_strTopicGuid, Object p_obj)
      Try to convert the given object to a reasonable JSON representation and send the result to the client.

      Note that automatic conversion to JSON usually works for null, boolean values, numbers, text data, date values, as well as collections and maps that contain this types of objects. In cases where automatic conversion does not work, sendTextMessage(String, String) can be used to send custom serialized JSON to the client.

      Parameters:
      p_strTopicGuid - The GUID of the WebSocket topic.
      p_obj - The object to be sent.
      Returns:
      The JSON string representation sent to the client.