Class: StompServer::TopicManager

### Home Classes Methods

### In Files

- lib/stomp_server/topic_manager.rb

### Parent

Object

### Methods

- ::new
- #disconnect
- #index
- #next_index
- #sendmsg
- #subscribe
- #unsubscribe

### Files

- History.txt
- Manifest.txt
- README.txt
- README.txt

### Class/Module Index

Quicksearch

- StompServer
- StompServer::ActiveRecordQueue
- StompServer::Configurator
- StompServer::DBMQueue
- StompServer::FileQueue
- StompServer::MemoryQueue
- StompServer::Protocols
- StompServer::Protocols::Http
- StompServer::Protocols::Stomp
- StompServer::Queue
- StompServer::QueueManager
- StompServer::QueueMonitor
- StompServer::Run
- StompServer::StompAuth
- StompServer::StompFrame
- StompServer::StompFrameRecognizer
- StompServer::StompId
- StompServer::StompUser
- StompServer::TestServer
- StompServer::TopicManager
- Mongrel
- Mongrel::HttpRequest
- ArMessage

No matching classes.

# StompServer::TopicManager

### Attributes

frame_index[RW]

### Public Class Methods

new() click to toggle source

    # File lib/stomp_server/topic_manager.rb, line 6
    def initialize
      @frame_index =0
      @topics = Hash.new { Array.new }
      puts "TopicManager initialized"
    end

### Public Instance Methods

disconnect(user) click to toggle source

    # File lib/stomp_server/topic_manager.rb, line 28
    def disconnect(user)
      @topics.each do |dest, queue|
        queue.delete_if { |qu| qu == user }
      end
    end

index() click to toggle source

    # File lib/stomp_server/topic_manager.rb, line 12
    def index
      @frame_index
    end

next_index() click to toggle source

    # File lib/stomp_server/topic_manager.rb, line 16
    def next_index
      @frame_index += 1
    end

sendmsg(msg) click to toggle source

    # File lib/stomp_server/topic_manager.rb, line 34
    def sendmsg(msg)
      msg.command = "MESSAGE"
      topic = msg.headers['destination']
      @topics[topic].each do |user|
        user.stomp_send_data(msg)
      end
    end

subscribe(topic, user) click to toggle source

    # File lib/stomp_server/topic_manager.rb, line 20
    def subscribe(topic, user)
      @topics[topic] += [user]
    end

unsubscribe(topic, user) click to toggle source

    # File lib/stomp_server/topic_manager.rb, line 24
    def unsubscribe(topic, user)
      @topics[topic].delete(user)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.