Just a second...

Connecting through a load balancer

Connections between Diffusion™ clients and Diffusion servers can be routed through a load balancer. Some clients can pass additional information to a load balancer in the request path of their URL.

Supported in: JavaScript®, Apple®, Android™, C and Java™ APIs

An additional request path can be specified to define the connection URL context.

    host : 'host_name',
    port : 'port',
    transports : 'transport',
    secure : false,
    path: '/path/diffusion'
}).then(function(session) { ... } );
Java and Android
final Session session = Diffusion
NSString *const host = @"host";
NSString *const additionalInformationAsPath = @"path";

// Formulate the URL string for connection via secure WebSocket,
// appending the required '/diffusion' suffix.
NSString *const url = [NSString stringWithFormat:@"wss://%@/%@/diffusion",
    host, additionalInformationAsPath];

// Open the session, using the formulated URL.
[PTDiffusionSession openWithURL:[NSURL URLWithString:url]
              completionHandler:^(PTDiffusionSession *session, NSError *error)
    // Check error is `nil`, then use session as required.
    // Ensure to maintain a strong reference to the session beyond the lifetime
    // of this callback, for example by assigning it to an instance variable.

Specify a request path that begins with / and ends with /diffusion. The default value is /diffusion.

Load balancer configuration

Connections between Diffusion clients and Diffusion servers have specific requirements. If your load balancer handles Diffusion connections incorrectly, for example by routing subsequent client requests to different backend Diffusion servers, this can cause problems for your solution.

For more information about how to configure your load balancers to work with Diffusion, see Load balancers.