Sha256: a79f31d1669be6cb47a3a3506b755e177c21ee3de49fcea9c8497ed4936bd2c7

Contents?: true

Size: 659 Bytes

Versions: 16

Compression:

Stored size: 659 Bytes

Contents

module Startback
  module Websocket
    module Hub
      #
      # The Hub is a very opinionated websocket protocol based on room and
      # subscriptions, allowing users to subscribe to rooms etc etc... # TODO
      #
      class App < Websocket::App

        def initialize(context, rooms, handler)
          super(context)
          @handler = handler
          @rooms = rooms
        end

        def room(name)
          @rooms[name]
        end

        def on_message(event, ws, env)
          @handler.call(Message.new(event.data, ws), ws, env)
        end

      end # class App
    end # module Hub
  end # module Websocket
end # module Startback

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
startback-websocket-0.17.4 lib/startback/websocket/hub/app.rb
startback-websocket-0.17.3 lib/startback/websocket/hub/app.rb
startback-websocket-0.17.2 lib/startback/websocket/hub/app.rb
startback-websocket-0.17.1 lib/startback/websocket/hub/app.rb
startback-websocket-0.17.0 lib/startback/websocket/hub/app.rb
startback-websocket-0.16.0 lib/startback/websocket/hub/app.rb
startback-websocket-0.15.5 lib/startback/websocket/hub/app.rb
startback-websocket-0.15.4 lib/startback/websocket/hub/app.rb
startback-websocket-0.15.3 lib/startback/websocket/hub/app.rb
startback-websocket-0.15.2 lib/startback/websocket/hub/app.rb
startback-websocket-0.15.1 lib/startback/websocket/hub/app.rb
startback-websocket-0.15.0 lib/startback/websocket/hub/app.rb
startback-websocket-0.14.4 lib/startback/websocket/hub/app.rb
startback-websocket-0.14.3 lib/startback/websocket/hub/app.rb
startback-websocket-0.14.2 lib/startback/websocket/hub/app.rb
startback-websocket-0.14.1 lib/startback/websocket/hub/app.rb