Sunday, 25 April 2010

StreamHub 2.1.12 beta Release - Server Integration Is Here

A brand new beta version of the StreamHub Reverse Ajax & Comet Server has been released today. The new 2.1 branch has been under development for months and has finally been released as a beta. The tagline for the 2.1 release is 'Server Integration'. Changes in the way StreamHub works now allow you to integrate Tomcat, Apache, JBoss, IIS or any other HTTP server with StreamHub, without comprimising on the highly-scalable streaming performance.

Using configureable contexts, StreamHub can be configured to transparently serve content from any downstream server. The core StreamHub NIO engine can sit in front of one or more web servers and routes requests to either the internal Comet engine or to the web servers behind.

To use this new feature, you'll need to setup a ForwardingHandler:


PushServer streamingServer = new NIOServer(80);
InetSocketAddress tomcatAddress = new InetSocketAddress(InetAddress.getLocalHost(), 8080);
streamingServer.addContext("/*", new ForwardingHandler(tomcatAddress));
streamingServer.start();


The example above will route any requests for http://myhost.com/ to a Tomcat instance running on port 8080 on the same host but the user will still see http://myhost.com/ in their browser. By default, any requests to the /streamhub/* context will be routed to StreamHub's internal Comet engine. That means, if you migrate any existing Comet apps to 2.1 you will need to change your connection URLs. For example, if previously you were using:


hub.connect("http://localhost:7979/");

From 2.1 onwards you will need to use:


hub.connect("http://localhost:7979/streamhub/");

The default /* context handler will use StreamHub's existing content handler, so you don't need to add a ForwardingHandler by default. The /* context handler will also act as a catch-all handler. Potentially you can have as many handlers as you like, routing different contexts to different physical servers.

What else is new in 2.1?
  • Numerous performance improvements to the HTTP handling.
  • Transparent failover to polling connections where firewalls/proxies prevent full duplex streaming.
  • Fixed: Ajax adapter was not reconnecting if no serverList was specified.
  • Fixed: 'Stopping polling' log message appeared even when not using a polling connection type.
  • More control over HTTP headers for pages and comet content.

Transparent failover to polling

The StreamHub Ajax SDK always attempts to establish the best connection possible with the server. Where a true streaming connection cannot be established, normally because a proxy or firewall is attempting to read the entire connection before forwarding, StreamHub will now failover to a polling connection without interrupting the users experience.


HTTP header control

Two new methods have been introduced to the PushServer interface to give you more control over the HTTP headers that StreamHub sends out. StreamHub will send a different set of headers for synchronous requests (e.g. subscriptions), than those it will send out for asynchronous push requests (e.g. the streaming channel). You now can override or set your own default headers for both of these types of request.

The example below, allows you to control the charset of data added to a JsonPayload:


server.setDefaultPushHeader("Content-Type", "text/html; charset=UTF-8");


Get the latest version

Find the latest 2.1.12-beta available to download below aswell as links to the most up-to-date documentation and tutorials:

More coming soon, as usual, subscribe to this blog or follow us on twitter to keep up to date.

No comments:

Post a Comment

Post a Comment