# Good solution for two-way network socket?

**URL:** <https://www.ruby-forum.com/t/good-solution-for-two-way-network-socket/176661>\
**Category:** Rails\
**Created:** [October 4, 2009, 11:46am UTC](https://www.ruby-forum.com/t/good-solution-for-two-way-network-socket/176661 "2009-10-04T11:46:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jamie](https://www.ruby-forum.com/u/jamie)\
**Post date:** [October 4, 2009, 11:46am UTC](https://www.ruby-forum.com/t/good-solution-for-two-way-network-socket/176661/1 "2009-10-04T11:46:07Z")

</div>

Hey,

I want to make a chat app, that connects to a chat server with a  
background process. It gets messages from the chat server and data  
from the web user that it sends to the server. I was trying to use  
EventMachine, but it only unblocks the thread when receiving data.

The best solution I can think of is to poll one of the two directions:  
either get data from the web user and poll for chat data, or get data  
from the chat server and poll for web user data.

Anyone know of a good two-way solution, am I stuck?

Thanks,  
Jamie
