WebSockets support added to Warlock

The Warlock server has just had a major overhaul that sees a lot of new features being added as well as a few niggling problems being fixed up and generally just made to work better.\r\n\r\nRead on to find out all the juicy details!

Introduction to Warlock

Warlock has not officially been released yet and is only available as part of the master branch in GIT. Because of this, it may not be immediately obvious what exactly Warlock is. Well, in short, Warlock is the awesomness located at centre of the universe. 

Seriously though, Warlock is Hazaars back-end processing server and is capable of running and managing services, executing delayed code and managing the real-time signalling features of Hazaar.

WebSockets Support

See issue #33. 

The recent updates are mainly to do with the ‘push technology’ (aka real-time signalling) and how it works with the browser. Previously Hazaar only supported a push technology called Comet, also known as long-polling. How long-polling works is the browser opens a normal HTTP session with the web server but the server, instead of responding immediately with the requested data, holds the connection open until there is data to send (in our case, a ‘signal’). It then sends the data and closes the connection as normal. The browser client will then immediately re-open the connection and wait for the next piece of data. 

This is not a true ‘push’ method but it gives the illusion of one. And to this day is working quite well. The downside is really the overhead involved in creating a new HTTP connection for each piece of data being pushed. If a large number of ‘packets’ are being pushed then lag can be introduced, and lag is bad. 

As of late, most current versions web browsers now support a protocol called WebSockets. This protocol allows the browser to support REAL push technology. In a nutshell it works by opening a connection to the server, does some handshaking and then data can be sent in either direction in real-time. The benefits are bountiful, least of which is the lack of overhead as once the connection is negotiated, the only data being sent/received is the data your application uses. 

Services

Services are now implemented in a much more reliable way and are also now capable of using the real-time signalling features of Hazaar out of the box. For more information on services see Services

Delayed Execution

The delayed execution code has also been revamped. For info on how to use delayed function execution see Delayed Execution

Warlock Control Panel

The Warlock control panel has also had a rather hefty update. As part of this, the Hazaar\File\RRD class has been created to allow the control panel to record statistics in a round robin database. These stats are then displayed on the control panel dashboard as pretty graphs. You can see the Warlock control panel on your application by pointing your browser to the _/warlock_ controller for your application. 

For example, if your application is hosted on www.example.com and is in a directory called _myapp_, the URL would be @http://www.example.com/myapp/warlock@.

Leave a Reply