Method: Cod::SocketServer#get_ext

Defined in:
lib/cod/socket_server.rb

#get_ext(opts = {}) ⇒ Array<Object, TcpClient>

Receives one object from the channel. Returns a tuple of <message,channel> where channel is a tcp channel that links back to the client that sent message.

Using this method, the server can communicate back to its clients individually instead of collectively.

Examples:

Answering to the client that sent a specific message

msg, chan = server.get_ext
chan.put :answer

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<Object, TcpClient>)

    tuple of the message that was sent a channel back to the client that sent the message



50
51
52
53
54
55
# File 'lib/cod/socket_server.rb', line 50

def get_ext(opts={})
  msg, socket = _get(opts)
  return [
    msg, 
    back_channel(socket)]
end