James Arthur's personal blog.

  • Archive
  • RSS

WebSockets with Varnish and Nginx

Nginx is the obvious front-end web server for non-blocking web applications. However, Nginx doesn’t currently support WebSockets (at the time of writing the feature is on their roadmap with “No date set”).

You can compile Nginx with the tcp module to proxy WebSocket and HTTP traffic to different backends. However, as well as introducing the manual compilation step, this also requires running multiple web applications (for example, your main app on one port and your WebSocket handlers on another).

A more elegant solution is to put Nginx in front of your backend web application and Varnish in front of Nginx. Varnish can then be configured to pass WebSocket traffic directly to your backend whilst sending the rest of the traffic to Nginx. This allows you to run a single backend server that handles WebSockets and HTTP traffic on the same port without patching Nginx.

Read More

    • #sysadmin
    • #websockets
    • #nginx
    • #web development
  • 1 week ago
  • 5
  • Comments
  • Permalink
  • Share
    Tweet

Released pyramid_assetgen package.

I’ve released a Python package called pyramid_assetgen that helps integrate Tav’s Assetgen static build tool with the Pyramid web application development framework. As the docs say:

Using it allows you to code in languages (like CoffeeScript and SASS) that compile to JavaScript and CSS, swapping between a refresh-the-page-to-see-changes development environment and an optimal HTTP caching production setup — without ever having to change any of the code in your Pyramid application.

    • #web development
    • #python
    • #pyramid
  • 4 months ago
  • 16
  • Comments
  • Permalink
  • Share
    Tweet

Filter by Proximity, Sort by Most Recent

This post is about a user interface pattern, a common use case for it and an example implementation. The pattern is adding an extra dimension to a timeline. The use case is showing results that are both recent and nearby. The example implementation uses a slider widget and an adequate-result-volume algorithm.

When you have 1000 messages and you want to prioritise the best 50 to display, sort is the most common pattern. If the user is interested in the latest messages, sort by most recent. If they want to see the messages other users found interesting, sort by a metric like views or rating. However, the web is increasingly about real time data. Developers are processing streams and modelling tubes instead of tables. It rarely makes sense to display real time data in any order apart from most recent. So, what do you do when you want to prioritise by another dimension, like proximity or rating?

Read More

    • #web development
    • #python
    • #coffeescript
  • 5 months ago
  • 6
  • Comments
  • Permalink
  • Share
    Tweet

About

Hi, I'm James Arthur, aka @thruflo. I'm a geek generalist, based in London, available for consulting work.

Email thruflo@gmail.com if you'd like to get in touch.

Pages

  • About Me
  • Recommendations

Me, Elsewhere

  • @thruflo on Twitter
  • thruflo on Delicious
  • Linkedin Profile
  • thruflo on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr