# Ruby web servers, threads and sessions

**URL:** <https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283>\
**Category:** Ruby\
**Created:** [December 4, 2006, 8:22pm UTC](https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283 "2006-12-04T20:22:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 4, 2006, 8:22pm UTC](https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283/1 "2006-12-04T20:22:38Z")

</div>

Is there a pure ruby web server that can start a thread that performs  
some task and store it in a session allowing the user to control the  
task from the browser? Similar to a what I can do with a java web  
server?

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 4, 2006, 8:34pm UTC](https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283/2 "2006-12-04T20:34:41Z")

</div>

On Dec 4, 2006, at 11:20 , eching wrote:

> Is there a pure ruby web server that can start a thread that performs  
> some task and store it in a session allowing the user to control the  
> task from the browser? Similar to a what I can do with a java web  
> server?

WEBrick + your custom code.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)

I LIT YOUR GEM ON FIRE!

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 4, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283/3 "2006-12-04T20:36:43Z")

</div>

eching wrote:

> Is there a pure ruby web server that can start a thread that performs  
> some task and store it in a session allowing the user to control the  
> task from the browser? Similar to a what I can do with a java web  
> server?

Your question isn’t crystal clear, but look at webrick, see if it’s what  
you  
have in mind. Webrick is included in a standard Ruby installation.

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 4, 2006, 8:50pm UTC](https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283/4 "2006-12-04T20:50:45Z")

</div>

Eric H. wrote:

> Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)
> 
> I LIT YOUR GEM ON FIRE!

Ah, looks pretty straight forward, thanks.

Ok, so is it realistic to start up a Drb server and store it in a  
session? Really what I am looking to do is to be able to control ruby  
applications on various hosts from a web client using the web server as  
the central hub.

The basic idea is a distributed log scanner app where the user can  
control (add files, remove files, change search string) “scanning  
agents” that are running on different hosts.

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 4, 2006, 10:01pm UTC](https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283/5 "2006-12-04T22:01:11Z")

</div>

> Yes, you can do this, but if the purpose is to govern the behavior of remote  
> machines, and if there are any security issues, I personally would do it  
> using SSH instead.
> 
> You could set things up to tunnel the webrick content through an SSH  
> connection. That is a way to balance ease of use with good security.
> 
> I am not perfectly clear about what you are trying to accomplish, but if  
> your description is a suitable guide, then maybe a text-based SSH remote  
> execution approach might be better than one based on a a Web server.

Thanks for the responses. It’s all over the LAN, so security isn’t a  
concern at this point. I’ll guess I’ll go ahead with my initial idea.  
I really haven’t done much web/web based programming (or distributed  
programming, really, apart from basic sockets), so any other  
suggestions are welcome.

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 4, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/ruby-web-servers-threads-and-sessions/78283/6 "2006-12-04T21:41:09Z")

</div>

eching wrote:

> > 
> 
> the central hub.
> 
> The basic idea is a distributed log scanner app where the user can  
> control (add files, remove files, change search string) “scanning  
> agents” that are running on different hosts.

Yes, you can do this, but if the purpose is to govern the behavior of  
remote  
machines, and if there are any security issues, I personally would do it  
using SSH instead.

You could set things up to tunnel the webrick content through an SSH  
connection. That is a way to balance ease of use with good security.

I am not perfectly clear about what you are trying to accomplish, but if  
your description is a suitable guide, then maybe a text-based SSH remote  
execution approach might be better than one based on a a Web server.
