Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat are some good ways to make an async web app on ruby these days?
    primarykey
    data
    text
    <p>I'm looking to build a webapp with a WebSocket component, and a run of the mill rack based frontend. My initial plan was to use Camping for the frontend, running the server on thin, with a rack <code>config.ru</code> looking like this:</p> <pre><code>require 'rack' require './parts/web-frontend' require './parts/websocket' AppStationary = Rack::File.new("./stationary") run Rack::Cascade.new(AppWebSockets, AppWebPages, AppStationary) </code></pre> <p><code>AppWebSockets</code> is being provided by websocket-rack and works great. In the absence of an <code>Upgrade: WebSocket</code> request it simply 404's and the request runs down the cascade to the camping app, <code>AppWebPages</code>.</p> <p>It's becoming clear that this camping webapp inevitably requires access to IO, to talk with the CouchDB database using regular http requests. There are plenty of ways to do http requests, including some async libraries compatible with eventmachine. If I subscribe to a callback, rack returns and the page has already responded by the time I'm ready to create a response. I'd like to be able to use em-synchrony to get some concurrency via Ruby 1.9's Fibers - which I've only just gotten my head around - but cannot find any documentation on how to make use of em-synchrony with Thin.</p> <p>I've encountered a webserver called Goliath which claims to be similar to thin, with em-synchrony support baked in, but it lacks a command line utility to launch and test the server and seems to require I write a different sort of file to a rackup, which is quite distasteful. It also is unclear if it would even support websocket-rack, which only specifies support for Thin currently.</p> <p>What are some good ways to avoid blocking IO while still making use of familiar rack based tools like camping, and having access to WebSockets?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload