# A simple chat in Ruby

**URL:** <https://www.ruby-forum.com/t/a-simple-chat-in-ruby/121384>\
**Category:** Ruby\
**Created:** [November 27, 2007, 2:31pm UTC](https://www.ruby-forum.com/t/a-simple-chat-in-ruby/121384 "2007-11-27T14:31:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jspencer78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@jspencer78](https://www.ruby-forum.com/u/jspencer78)\
**Post date:** [November 27, 2007, 2:31pm UTC](https://www.ruby-forum.com/t/a-simple-chat-in-ruby/121384/1 "2007-11-27T14:31:16Z")

</div>

Firstly, excuse for my english, i’m a french student.

I develop a chat in ruby with DRB/Rinda and i use tuplespace but i don’t  
understand how the tuplespaces work.

I have a server :

while true

#on lit le tuple

messlu\_Server = tuple\_space.take([:message,nil])[1]  
tuple\_space.write [:message,messlu\_Server]

#on dort 1 seconde  
sleep(1)  
end

and a client:

who read the tuplescape with this line :

messlu = @ts.read([:message,nil])[1]  
@buffer.set\_text(messlu)

(I work with Glade 2 to build my program)

I have two questions :

How I can send more tuple in my tuplespace? Example : tuple\_space.write  
[:message,:id,messlu\_Server,id] does not work

With my chat, messages are not synchronisez. client1 send a message, but  
client2 does’nt receive the message and when client1 send an another  
message, he read the last message. What’s the best solution…
