Class OptimizedBroadcaster

java.lang.Object
org.glassfish.grizzly.websockets.OptimizedBroadcaster
All Implemented Interfaces:
Broadcaster

public class OptimizedBroadcaster extends Object implements Broadcaster
The default Broadcaster optimized to send the same text to a set of clients. NOTE: works with DefaultWebSockets and inherited classes.
Author:
Alexey Stashok
  • Constructor Details

    • OptimizedBroadcaster

      public OptimizedBroadcaster()
  • Method Details

    • broadcast

      public void broadcast(Iterable<? extends WebSocket> recipients, String text)
      Broadcasts the provided text content to the specified recipients.
      Specified by:
      broadcast in interface Broadcaster
      Parameters:
      recipients - the recipients of the provided text content.
      text - textual content.
    • broadcast

      public void broadcast(Iterable<? extends WebSocket> recipients, byte[] binary)
      Broadcasts the provided binary content to the specified recipients.
      Specified by:
      broadcast in interface Broadcaster
      Parameters:
      recipients - the recipients of the provided binary content.
      binary - binary content.
    • broadcastFragment

      public void broadcastFragment(Iterable<? extends WebSocket> recipients, String text, boolean last)
      Description copied from interface: Broadcaster
      Broadcasts the provided fragmented text content to the specified recipients.
      Specified by:
      broadcastFragment in interface Broadcaster
      Parameters:
      recipients - the recipients of the provided fragmented text content.
      text - fragmented textual content.
      last - true if this is the last fragment, otherwise false.
    • broadcastFragment

      public void broadcastFragment(Iterable<? extends WebSocket> recipients, byte[] binary, boolean last)
      Description copied from interface: Broadcaster
      Broadcasts the provided fragmented binary content to the specified recipients.
      Specified by:
      broadcastFragment in interface Broadcaster
      Parameters:
      recipients - the recipients of the provided fragmented binary content.
      binary - fragmented binary content.
      last - true if this is the last fragment, otherwise false.