Configure the Gateway to Use Multicast

This procedure demonstrates how to configure a service that is running on Kaazing Gateway to use a multicast address.

For the multicast connections, the Gateway uses UDP for the back-end server connection and Server-Sent Events (SSE) or WebSocket for the front-end client connections. Using this configuration, the Gateway enables the LAN-based UDP protocol to be broadcast over the Web.

To configure a service to use multicast, you must specify the following elements in the Gateway configuration file (for example, GATEWAY_HOME/conf/gateway-config.xml):

The following example shows a broadcast service using a multicast address. The broadcast service connects to a back-end service, and sends any messages from the back-end service outwards to clients connected over the address in its accept.

In the example, data packets sent using UDP multicast from udp://224.0.0.1:9001 to the Gateway will be broadcast to all server-sent events (SSE) clients connected to the Gateway at address sse://example.com:8000/sse. The sse:// scheme is used for SSE connections. To learn more about SSE, see Using server-sent events from MDN.

<service>
  <name>Broadcast multicast messages</name>

  <accept>sse://example.com:8000/sse</accept>
  <connect>udp://224.0.0.1:9001</connect>

  <type>broadcast</type>

  <connect-options>
    <udp.interface>@eth0</udp.interface>
    <!-- <udp.interface>[@Windows Network Interface Description]</udp.interface> -->
  </connect-options>

  <cross-site-constraint>
    <allow-origin>http://example.com:8000</allow-origin>
  </cross-site-constraint>

  <cross-site-constraint>
    <allow-origin>https://example.com:9000</allow-origin>
  </cross-site-constraint>
</service>

See Also